diff options
author | Doris Verria <doris.verria@qt.io> | 2022-06-08 11:50:44 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-06-15 19:53:25 +0000 |
commit | 71571642e8cf8d4e9e6b22ed02055db18234cbb4 (patch) | |
tree | d6d081b85bc74e8c335474adf989d84e3aa927d6 | |
parent | ccea79f987f82d79cfbca0cbf371a64af24f0ea4 (diff) |
iOS Style: Add GroupBox control
Change-Id: I4a93fc75b96e4750924f90455ba675dbf7dbfb64
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 7fba49bc38d58b31cfa302aaba94557ad1b47a1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/quickcontrols2/ios/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/quickcontrols2/ios/GroupBox.qml | 42 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/quickcontrols2/ios/CMakeLists.txt b/src/quickcontrols2/ios/CMakeLists.txt index cbff8861ed..bd5fabbb7a 100644 --- a/src/quickcontrols2/ios/CMakeLists.txt +++ b/src/quickcontrols2/ios/CMakeLists.txt @@ -28,6 +28,7 @@ set(qml_files "ToolButton.qml" "MenuBarItem.qml" "Frame.qml" + "GroupBox.qml" ) set_source_files_properties(Slider.qml PROPERTIES QT_QML_SOURCE_VERSIONS "2.2;6.0" diff --git a/src/quickcontrols2/ios/GroupBox.qml b/src/quickcontrols2/ios/GroupBox.qml new file mode 100644 index 0000000000..c2b449f7fe --- /dev/null +++ b/src/quickcontrols2/ios/GroupBox.qml @@ -0,0 +1,42 @@ +// Copyright (C) 2022 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.iOS + +T.GroupBox { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding, + implicitLabelWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + padding: 16 + leftPadding: 20 + rightPadding: 20 + topPadding: padding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0) + spacing: 10 + + label: Text { + x: control.leftPadding + width: control.availableWidth + + text: control.title + font.pointSize: control.font.pointSize - 2.0 + font.capitalization: Font.AllUppercase + color: control.palette.placeholderText + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + + background: Rectangle { + y: control.topPadding - control.bottomPadding + width: parent.width + height: parent.height - control.topPadding + control.bottomPadding + radius: 9 + color: control.IOS.theme === IOS.Dark ? control.palette.light : control.palette.base + } +} |