ConfirmDialog.qml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (C) 2016 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. import QtQuick
  4. import QtQuick.Controls
  5. import QtQuick.Layouts
  6. Dialog {
  7. property alias text: message.text
  8. property bool handled: false
  9. title: qsTr("Confirm Dialog")
  10. modal: false
  11. anchors.centerIn: parent
  12. objectName: "confirmDialog"
  13. ColumnLayout {
  14. id: rootLayout
  15. anchors.fill: parent
  16. anchors.margins: 4
  17. property int minimumWidth: rootLayout.implicitWidth + rootLayout.doubleMargins
  18. property int minimumHeight: rootLayout.implicitHeight + rootLayout.doubleMargins
  19. property int doubleMargins: anchors.margins * 2
  20. SystemPalette { id: palette; colorGroup: SystemPalette.Active }
  21. RowLayout {
  22. Layout.alignment: Qt.AlignRight
  23. spacing: 8
  24. Image {
  25. source: "qrc:/qt-project.org/imports/QtWebEngine/ControlsDelegates/question.png"
  26. }
  27. Text {
  28. id: message
  29. Layout.fillWidth: true
  30. color: palette.windowText
  31. textFormat: Text.PlainText
  32. }
  33. }
  34. Item {
  35. Layout.fillHeight: true
  36. }
  37. RowLayout {
  38. Layout.alignment: Qt.AlignRight
  39. spacing: 8
  40. Button {
  41. text: qsTr("OK")
  42. onClicked: accept()
  43. }
  44. Button {
  45. text: qsTr("Cancel")
  46. onClicked: reject()
  47. }
  48. }
  49. }
  50. }