aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/universal/DialogButtonBox.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/universal/DialogButtonBox.qml')
-rw-r--r--src/quickcontrols/universal/DialogButtonBox.qml43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/quickcontrols/universal/DialogButtonBox.qml b/src/quickcontrols/universal/DialogButtonBox.qml
new file mode 100644
index 0000000000..4a7e4f0ede
--- /dev/null
+++ b/src/quickcontrols/universal/DialogButtonBox.qml
@@ -0,0 +1,43 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Templates as T
+import QtQuick.Controls.Universal
+
+T.DialogButtonBox {
+ id: control
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ (control.count === 1 ? implicitContentWidth * 2 : implicitContentWidth) + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+ contentWidth: (contentItem as ListView)?.contentWidth
+
+ spacing: 4
+ padding: 24
+ topPadding: position === T.DialogButtonBox.Footer ? 6 : 24
+ bottomPadding: position === T.DialogButtonBox.Header ? 6 : 24
+ alignment: count === 1 ? Qt.AlignRight : undefined
+
+ delegate: Button {
+ width: control.count === 1 ? control.availableWidth / 2 : undefined
+ }
+
+ contentItem: ListView {
+ implicitWidth: contentWidth
+ model: control.contentModel
+ spacing: control.spacing
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+ snapMode: ListView.SnapToItem
+ }
+
+ background: Rectangle {
+ implicitHeight: 32
+ color: control.Universal.chromeMediumLowColor
+ x: 1; y: 1
+ width: parent.width - 2
+ height: parent.height - 2
+ }
+}