From 20b9437d54b16abfdd7528868dea2a6c6de0c349 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 10 Jan 2020 14:10:30 +0100 Subject: set placeholderText by default, not text Task-number: QDS-456 Change-Id: I05b7ce9efab851b99d12ba272a79bf9ba4443398 Reviewed-by: Thomas Hartmann Reviewed-by: Mitch Curtis --- src/imports/controls/designer/qtquickcontrols2.metainfo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/designer/qtquickcontrols2.metainfo b/src/imports/controls/designer/qtquickcontrols2.metainfo index 9e6030b1..d27f1b90 100644 --- a/src/imports/controls/designer/qtquickcontrols2.metainfo +++ b/src/imports/controls/designer/qtquickcontrols2.metainfo @@ -443,7 +443,7 @@ MetaInfo { version: "2.0" requiredImport: "QtQuick.Controls" - Property { name: "text"; type: "binding"; value: "qsTr(\"Text Area\")" } + Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Area\")" } } } @@ -458,7 +458,7 @@ MetaInfo { version: "2.0" requiredImport: "QtQuick.Controls" - Property { name: "text"; type: "binding"; value: "qsTr(\"Text Field\")" } + Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Field\")" } } } -- cgit v1.2.3 From c5c945006244b6bf5189f1949a009f70ebd51d7a Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 27 Jan 2020 10:58:50 +0100 Subject: Doc: fix RangeSlider errors When the RangeSlider was copied into another file as a child item, it would produce errors about first and second being undefined. Change-Id: I0ecc9f6830509183a1b2b35e3faed5f06e78a0ef Fixes: QTBUG-80970 Reviewed-by: Shawn Rutledge --- .../controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml index 1c5db214..b8510ddd 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml @@ -54,22 +54,22 @@ RangeSlider { } first.handle: Rectangle { - x: control.leftPadding + first.visualPosition * (control.availableWidth - width) + x: control.leftPadding + control.first.visualPosition * (control.availableWidth - width) y: control.topPadding + control.availableHeight / 2 - height / 2 implicitWidth: 26 implicitHeight: 26 radius: 13 - color: first.pressed ? "#f0f0f0" : "#f6f6f6" + color: control.first.pressed ? "#f0f0f0" : "#f6f6f6" border.color: "#bdbebf" } second.handle: Rectangle { - x: control.leftPadding + second.visualPosition * (control.availableWidth - width) + x: control.leftPadding + control.second.visualPosition * (control.availableWidth - width) y: control.topPadding + control.availableHeight / 2 - height / 2 implicitWidth: 26 implicitHeight: 26 radius: 13 - color: second.pressed ? "#f0f0f0" : "#f6f6f6" + color: control.second.pressed ? "#f0f0f0" : "#f6f6f6" border.color: "#bdbebf" } } -- cgit v1.2.3 From 91eb563b278ca9c831c444380030c458adbf02f0 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 31 Jan 2020 09:52:16 +0100 Subject: Copy Qt Quick Designer-related files also for static builds Make sure that the 'designer' directory is copied to the build directory, or installed, also for static builds. This reverts the !static condition introduced to fix a build breakage in 01d076d0e81e5 . Anyhow, I couldn't reproduce the original problem (QTBUG-51708), nor is it clear why it was caused by the static build. Fixes: QTBUG-75682 Change-Id: I47af3907e464d4fd9e9965ac28545b7350f450ee Reviewed-by: Qt CI Bot Reviewed-by: Andy Shaw --- src/imports/controls/controls.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro index 2aeaf9ab..66373d55 100644 --- a/src/imports/controls/controls.pro +++ b/src/imports/controls/controls.pro @@ -19,7 +19,7 @@ SOURCES += \ RESOURCES += \ $$PWD/qtquickcontrols2plugin.qrc -!static: qtConfig(quick-designer): include(designer/designer.pri) +qtConfig(quick-designer): include(designer/designer.pri) include(doc/doc.pri) CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler -- cgit v1.2.3 From 0b607bfe14048e32dd81855e1497dda3465b5183 Mon Sep 17 00:00:00 2001 From: Yulong Bai Date: Thu, 11 Apr 2019 17:30:49 +0200 Subject: Add HorizontalHeaderView and VerticalHeaderView [ChangeLog][Controls] Add HorizontalHeaderView and VerticalHeaderView. They are controls associated with TableView. Support flicking synchronization Support default, fusion, imagine, material and universal delegate styles. Fixes: QTPM-1300 Change-Id: Ie3f913dd616cda0d4e5a22a3d95baf71692370fe Reviewed-by: Volker Hilsheimer --- src/imports/controls/HorizontalHeaderView.qml | 59 +++++++++++++++++++++ src/imports/controls/VerticalHeaderView.qml | 59 +++++++++++++++++++++ src/imports/controls/controls.pri | 4 +- .../controls/fusion/HorizontalHeaderView.qml | 59 +++++++++++++++++++++ src/imports/controls/fusion/VerticalHeaderView.qml | 59 +++++++++++++++++++++ src/imports/controls/fusion/fusion.pri | 4 +- .../controls/imagine/HorizontalHeaderView.qml | 59 +++++++++++++++++++++ .../controls/imagine/VerticalHeaderView.qml | 59 +++++++++++++++++++++ src/imports/controls/imagine/imagine.pri | 4 +- .../controls/material/HorizontalHeaderView.qml | 60 +++++++++++++++++++++ .../controls/material/VerticalHeaderView.qml | 60 +++++++++++++++++++++ src/imports/controls/material/material.pri | 4 +- src/imports/controls/qtquickcontrols2plugin.cpp | 4 ++ .../controls/universal/HorizontalHeaderView.qml | 61 ++++++++++++++++++++++ .../controls/universal/VerticalHeaderView.qml | 61 ++++++++++++++++++++++ src/imports/controls/universal/universal.pri | 4 +- 16 files changed, 615 insertions(+), 5 deletions(-) create mode 100644 src/imports/controls/HorizontalHeaderView.qml create mode 100644 src/imports/controls/VerticalHeaderView.qml create mode 100644 src/imports/controls/fusion/HorizontalHeaderView.qml create mode 100644 src/imports/controls/fusion/VerticalHeaderView.qml create mode 100644 src/imports/controls/imagine/HorizontalHeaderView.qml create mode 100644 src/imports/controls/imagine/VerticalHeaderView.qml create mode 100644 src/imports/controls/material/HorizontalHeaderView.qml create mode 100644 src/imports/controls/material/VerticalHeaderView.qml create mode 100644 src/imports/controls/universal/HorizontalHeaderView.qml create mode 100644 src/imports/controls/universal/VerticalHeaderView.qml (limited to 'src/imports/controls') diff --git a/src/imports/controls/HorizontalHeaderView.qml b/src/imports/controls/HorizontalHeaderView.qml new file mode 100644 index 00000000..946d3a75 --- /dev/null +++ b/src/imports/controls/HorizontalHeaderView.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T + +T.HorizontalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: "#f6f6f6" + border.color: "#e4e4e4" + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: "#ff26282a" + } + } +} diff --git a/src/imports/controls/VerticalHeaderView.qml b/src/imports/controls/VerticalHeaderView.qml new file mode 100644 index 00000000..67d4c1ce --- /dev/null +++ b/src/imports/controls/VerticalHeaderView.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T + +T.VerticalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: "#f6f6f6" + border.color: "#e4e4e4" + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: "#ff26282a" + } + } +} diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index fbf5d075..03fc0f4b 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -32,6 +32,7 @@ QML_FILES += \ $$PWD/Drawer.qml \ $$PWD/Frame.qml \ $$PWD/GroupBox.qml \ + $$PWD/HorizontalHeaderView.qml \ $$PWD/ItemDelegate.qml \ $$PWD/Label.qml \ $$PWD/Menu.qml \ @@ -67,4 +68,5 @@ QML_FILES += \ $$PWD/ToolButton.qml \ $$PWD/ToolSeparator.qml \ $$PWD/ToolTip.qml \ - $$PWD/Tumbler.qml + $$PWD/Tumbler.qml \ + $$PWD/VerticalHeaderView.qml diff --git a/src/imports/controls/fusion/HorizontalHeaderView.qml b/src/imports/controls/fusion/HorizontalHeaderView.qml new file mode 100644 index 00000000..946d3a75 --- /dev/null +++ b/src/imports/controls/fusion/HorizontalHeaderView.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T + +T.HorizontalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: "#f6f6f6" + border.color: "#e4e4e4" + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: "#ff26282a" + } + } +} diff --git a/src/imports/controls/fusion/VerticalHeaderView.qml b/src/imports/controls/fusion/VerticalHeaderView.qml new file mode 100644 index 00000000..67d4c1ce --- /dev/null +++ b/src/imports/controls/fusion/VerticalHeaderView.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T + +T.VerticalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: "#f6f6f6" + border.color: "#e4e4e4" + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: "#ff26282a" + } + } +} diff --git a/src/imports/controls/fusion/fusion.pri b/src/imports/controls/fusion/fusion.pri index 72978db5..bdc413fd 100644 --- a/src/imports/controls/fusion/fusion.pri +++ b/src/imports/controls/fusion/fusion.pri @@ -28,6 +28,7 @@ QML_FILES += \ $$PWD/Drawer.qml \ $$PWD/Frame.qml \ $$PWD/GroupBox.qml \ + $$PWD/HorizontalHeaderView.qml \ $$PWD/ItemDelegate.qml \ $$PWD/Label.qml \ $$PWD/Menu.qml \ @@ -64,4 +65,5 @@ QML_FILES += \ $$PWD/ToolButton.qml \ $$PWD/ToolSeparator.qml \ $$PWD/ToolTip.qml \ - $$PWD/Tumbler.qml + $$PWD/Tumbler.qml \ + $$PWD/VerticalHeaderView.qml diff --git a/src/imports/controls/imagine/HorizontalHeaderView.qml b/src/imports/controls/imagine/HorizontalHeaderView.qml new file mode 100644 index 00000000..946d3a75 --- /dev/null +++ b/src/imports/controls/imagine/HorizontalHeaderView.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T + +T.HorizontalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: "#f6f6f6" + border.color: "#e4e4e4" + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: "#ff26282a" + } + } +} diff --git a/src/imports/controls/imagine/VerticalHeaderView.qml b/src/imports/controls/imagine/VerticalHeaderView.qml new file mode 100644 index 00000000..67d4c1ce --- /dev/null +++ b/src/imports/controls/imagine/VerticalHeaderView.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T + +T.VerticalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: "#f6f6f6" + border.color: "#e4e4e4" + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: "#ff26282a" + } + } +} diff --git a/src/imports/controls/imagine/imagine.pri b/src/imports/controls/imagine/imagine.pri index 081a509e..4c6bcf1b 100644 --- a/src/imports/controls/imagine/imagine.pri +++ b/src/imports/controls/imagine/imagine.pri @@ -12,6 +12,7 @@ QML_FILES += \ $$PWD/Drawer.qml \ $$PWD/Frame.qml \ $$PWD/GroupBox.qml \ + $$PWD/HorizontalHeaderView.qml \ $$PWD/ItemDelegate.qml \ $$PWD/Label.qml \ $$PWD/Menu.qml \ @@ -44,7 +45,8 @@ QML_FILES += \ $$PWD/ToolButton.qml \ $$PWD/ToolSeparator.qml \ $$PWD/ToolTip.qml \ - $$PWD/Tumbler.qml + $$PWD/Tumbler.qml \ + $$PWD/VerticalHeaderView.qml HEADERS += \ $$PWD/qquickimageselector_p.h \ diff --git a/src/imports/controls/material/HorizontalHeaderView.qml b/src/imports/controls/material/HorizontalHeaderView.qml new file mode 100644 index 00000000..a1228cdc --- /dev/null +++ b/src/imports/controls/material/HorizontalHeaderView.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T +import QtQuick.Controls.Material 2.15 +import QtQuick.Controls.Material.impl 2.15 + +T.HorizontalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: control.Material.backgroundColor + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: enabled ? control.Material.foreground : control.Material.hintTextColor + } + } +} diff --git a/src/imports/controls/material/VerticalHeaderView.qml b/src/imports/controls/material/VerticalHeaderView.qml new file mode 100644 index 00000000..8acda3d7 --- /dev/null +++ b/src/imports/controls/material/VerticalHeaderView.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T +import QtQuick.Controls.Material 2.15 +import QtQuick.Controls.Material.impl 2.15 + +T.VerticalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: control.Material.backgroundColor + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: enabled ? control.Material.foreground : control.Material.hintTextColor + } + } +} diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri index bda1fb21..457a8df1 100644 --- a/src/imports/controls/material/material.pri +++ b/src/imports/controls/material/material.pri @@ -30,6 +30,7 @@ QML_FILES += \ $$PWD/ElevationEffect.qml \ $$PWD/Frame.qml \ $$PWD/GroupBox.qml \ + $$PWD/HorizontalHeaderView.qml \ $$PWD/ItemDelegate.qml \ $$PWD/Label.qml \ $$PWD/Menu.qml \ @@ -68,4 +69,5 @@ QML_FILES += \ $$PWD/ToolButton.qml \ $$PWD/ToolSeparator.qml \ $$PWD/ToolTip.qml \ - $$PWD/Tumbler.qml + $$PWD/Tumbler.qml \ + $$PWD/VerticalHeaderView.qml diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 260e7297..9fe82ba2 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -198,6 +198,10 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterUncreatableType(uri, 2, 13, "SplitHandle", QStringLiteral("SplitHandle is only available as an attached property.")); + // QtQuick.Controls 2.15 (new types in Qt 5.15) + qmlRegisterType(resolvedUrl(QStringLiteral("HorizontalHeaderView.qml")), uri, 2, 15, "HorizontalHeaderView"); + qmlRegisterType(resolvedUrl(QStringLiteral("VerticalHeaderView.qml")), uri, 2, 15, "VerticalHeaderView"); + // Register the latest version, even if there are no new types or new revisions for existing types yet. // Before Qt 5.12, we would do the following: // diff --git a/src/imports/controls/universal/HorizontalHeaderView.qml b/src/imports/controls/universal/HorizontalHeaderView.qml new file mode 100644 index 00000000..6f48560e --- /dev/null +++ b/src/imports/controls/universal/HorizontalHeaderView.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Controls.impl 2.15 +import QtQuick.Templates 2.15 as T +import QtQuick.Controls.Universal 2.15 +import QtQuick.Controls.Universal.impl 2.15 + +T.HorizontalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: control.Universal.background + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: Color.transparent(control.Universal.foreground, enabled ? 1.0 : 0.2) + } + } +} diff --git a/src/imports/controls/universal/VerticalHeaderView.qml b/src/imports/controls/universal/VerticalHeaderView.qml new file mode 100644 index 00000000..80133dbd --- /dev/null +++ b/src/imports/controls/universal/VerticalHeaderView.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Controls.impl 2.15 +import QtQuick.Templates 2.15 as T +import QtQuick.Controls.Universal 2.15 +import QtQuick.Controls.Universal.impl 2.15 + +T.VerticalHeaderView { + id: control + + delegate: Rectangle { + implicitWidth: 50 + implicitHeight: 25 + color: control.Universal.background + + Text { + text: model[control.textRole] + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: Color.transparent(control.Universal.foreground, enabled ? 1.0 : 0.2) + } + } +} diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri index 4440acbf..8f1b905c 100644 --- a/src/imports/controls/universal/universal.pri +++ b/src/imports/controls/universal/universal.pri @@ -13,6 +13,7 @@ QML_FILES += \ $$PWD/Drawer.qml \ $$PWD/Frame.qml \ $$PWD/GroupBox.qml \ + $$PWD/HorizontalHeaderView.qml \ $$PWD/ItemDelegate.qml \ $$PWD/Label.qml \ $$PWD/Menu.qml \ @@ -48,7 +49,8 @@ QML_FILES += \ $$PWD/ToolButton.qml \ $$PWD/ToolSeparator.qml \ $$PWD/ToolTip.qml \ - $$PWD/Tumbler.qml + $$PWD/Tumbler.qml \ + $$PWD/VerticalHeaderView.qml HEADERS += \ $$PWD/qquickuniversalbusyindicator_p.h \ -- cgit v1.2.3 From df7d1e9ba08ef181eb42515a2cde36a8c05ce0c8 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 11 Feb 2020 14:15:50 +0100 Subject: Make Fusion style header views look more fusiony Change-Id: I659f177ed721b16db7342f37d47d9c062ba2ef97 Reviewed-by: Volker Hilsheimer --- src/imports/controls/fusion/HorizontalHeaderView.qml | 14 ++++++++++++-- src/imports/controls/fusion/VerticalHeaderView.qml | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/fusion/HorizontalHeaderView.qml b/src/imports/controls/fusion/HorizontalHeaderView.qml index 946d3a75..0be27642 100644 --- a/src/imports/controls/fusion/HorizontalHeaderView.qml +++ b/src/imports/controls/fusion/HorizontalHeaderView.qml @@ -44,8 +44,18 @@ T.HorizontalHeaderView { delegate: Rectangle { implicitWidth: 50 implicitHeight: 25 - color: "#f6f6f6" - border.color: "#e4e4e4" + border.color: "#cacaca" + + gradient: Gradient { + GradientStop { + position: 0 + color: "#fbfbfb" + } + GradientStop { + position: 1 + color: "#e0dfe0" + } + } Text { text: model[control.textRole] diff --git a/src/imports/controls/fusion/VerticalHeaderView.qml b/src/imports/controls/fusion/VerticalHeaderView.qml index 67d4c1ce..a9eadc23 100644 --- a/src/imports/controls/fusion/VerticalHeaderView.qml +++ b/src/imports/controls/fusion/VerticalHeaderView.qml @@ -44,8 +44,18 @@ T.VerticalHeaderView { delegate: Rectangle { implicitWidth: 50 implicitHeight: 25 - color: "#f6f6f6" - border.color: "#e4e4e4" + border.color: "#cacaca" + + gradient: Gradient { + GradientStop { + position: 0 + color: "#fbfbfb" + } + GradientStop { + position: 1 + color: "#e0dfe0" + } + } Text { text: model[control.textRole] -- cgit v1.2.3 From 4a2cbb213a90fd6125fc5eb583dfa1cde84ad307 Mon Sep 17 00:00:00 2001 From: Yulong Bai Date: Tue, 28 Jan 2020 11:27:41 +0100 Subject: Add documentation for HorizontalHeaderView and VerticalHeaderView The example snippet only shows how to lay things out; since TableModel doesn't support declaring header data from QML yet, we also can't show it. Change-Id: Iaf1c4fd39a23be7271d382d743dc30ac459e37cb Reviewed-by: Mitch Curtis --- .../qtquickcontrols2-headerview-simple.qml | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml (limited to 'src/imports/controls') diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml new file mode 100644 index 00000000..bea46bf3 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//![file] +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import Qt.labs.qmlmodels 1.0 + +ApplicationWindow { + visible: true + width: 640 + height: 480 + + //! [horizontal] + HorizontalHeaderView { + id: horizontalHeader + syncView: tableView + anchors.left: tableView.left + width: parent.width + height: contentHeight + } + //! [horizontal] + + //! [vertical] + VerticalHeaderView { + id: verticalHeader + syncView: tableView + anchors.top: tableView.top + width: contentWidth + height: parent.height + } + //! [vertical] + + TableView { + id: tableView + anchors.fill: parent + anchors.topMargin: horizontalHeader.height + anchors.leftMargin: verticalHeader.width + columnSpacing: 1 + rowSpacing: 1 + clip: true + + model: TableModel { + TableModelColumn { display: "name" } + TableModelColumn { display: "color" } + + rows: [ + { + "name": "cat", + "color": "black" + }, + { + "name": "dog", + "color": "brown" + }, + { + "name": "bird", + "color": "white" + } + ] + } + + delegate: Rectangle { + implicitWidth: 100 + implicitHeight: 50 + border.width: 1 + + Text { + text: display + anchors.centerIn: parent + } + } + } +} + +//![file] -- cgit v1.2.3 From e7a9691481e4a0112138f442c53107aa9fbcb90a Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 12 Dec 2019 13:50:03 +0100 Subject: clang-tidy: fix bugprone-integer-division MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An example of one of the warnings: qquickfusiondial.cpp:87:15: warning: result of integer division used in a floating point context; possible loss of precision [bugprone-integer-division] Change-Id: I9d225e8149935a8f8dde6e8b0657c1406676b7f1 Reviewed-by: Jan Arve Sæther --- src/imports/controls/fusion/qquickfusiondial.cpp | 2 +- src/imports/controls/qquickdefaultbusyindicator.cpp | 2 +- src/imports/controls/qquickdefaultprogressbar.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/fusion/qquickfusiondial.cpp b/src/imports/controls/fusion/qquickfusiondial.cpp index 182f5c0f..50436634 100644 --- a/src/imports/controls/fusion/qquickfusiondial.cpp +++ b/src/imports/controls/fusion/qquickfusiondial.cpp @@ -84,7 +84,7 @@ void QQuickFusionDial::paint(QPainter *painter) QColor buttonColor = m_palette.button().color(); const bool enabled = isEnabled(); - qreal r = qMin(width, height) / 2; + qreal r = qMin(width, height) / 2.0; r -= r/50; const qreal penSize = r/20.0; diff --git a/src/imports/controls/qquickdefaultbusyindicator.cpp b/src/imports/controls/qquickdefaultbusyindicator.cpp index 98a3cae3..aca795d9 100644 --- a/src/imports/controls/qquickdefaultbusyindicator.cpp +++ b/src/imports/controls/qquickdefaultbusyindicator.cpp @@ -124,7 +124,7 @@ void QQuickDefaultBusyIndicatorNode::sync(QQuickItem *item) Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); QPointF pos = QPointF(sz / 2 - circleRadius, sz / 2 - circleRadius); - pos = moveCircle(pos, 360 / CircleCount * i, sz / 2 - circleRadius); + pos = moveCircle(pos, 360.0 / CircleCount * i, sz / 2 - circleRadius); QMatrix4x4 m; m.translate(dx + pos.x(), dy + pos.y()); diff --git a/src/imports/controls/qquickdefaultprogressbar.cpp b/src/imports/controls/qquickdefaultprogressbar.cpp index e8657255..f44065e4 100644 --- a/src/imports/controls/qquickdefaultprogressbar.cpp +++ b/src/imports/controls/qquickdefaultprogressbar.cpp @@ -59,7 +59,7 @@ static inline qreal blockStartX(int blockIndex) static inline qreal blockRestX(int blockIndex, qreal availableWidth) { - const qreal spanRightEdgePos = availableWidth / 2 + BlockSpan / 2; + const qreal spanRightEdgePos = availableWidth / 2 + BlockSpan / 2.0; return spanRightEdgePos - (blockIndex + 1) * BlockWidth - (blockIndex * BlockRestingSpacing); } -- cgit v1.2.3 From 1f7959d3dd5942fe7f7553bba16583c37a4969a8 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 25 Feb 2020 13:32:54 +0100 Subject: Imagine: fix Dial being squished - Since we probably don't want to wrap the background in an Item, use "fillMode: Image.PreserveAspectFit" on it to ensure that the background isn't squished. - Use the same binding for the Translate's y property as we do in all of the other styles. Fixes: QTBUG-82463 Change-Id: I43129959e03ad489a8c231a7a42c192264b380ac Reviewed-by: Richard Moe Gustavsen --- src/imports/controls/imagine/Dial.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/imagine/Dial.qml b/src/imports/controls/imagine/Dial.qml index f10634e6..f8c394f3 100644 --- a/src/imports/controls/imagine/Dial.qml +++ b/src/imports/controls/imagine/Dial.qml @@ -74,7 +74,7 @@ T.Dial { transform: [ Translate { - y: -background.height * 0.4 + handle.height / 2 + y: -Math.min(control.background.width, control.background.height) * 0.4 + control.handle.height / 2 }, Rotation { angle: control.angle @@ -89,6 +89,7 @@ T.Dial { y: control.height / 2 - height / 2 width: Math.max(64, Math.min(control.width, control.height)) height: width + fillMode: Image.PreserveAspectFit source: Imagine.url + "dial-background" NinePatchImageSelector on source { -- cgit v1.2.3 From 6cdd4b53031de17b36b30b00de0a6945470a35ad Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 19 Feb 2020 15:56:38 +0100 Subject: HeaderView: set implicitSize on the style items By setting an implicit size, the user don't need to set a width or height on a HeaderView himself, but it will get the default size recommended by the style. By doing it the way it's done in the patch we achieve the following: 1. A HeaderView will by default be resized to be the same size as the delegate. 2. If the application sets a size on HeaderView it that is larger than the implicit size of the delegate, the delegate will be resized to have the same size (effectively filling out the free space in the header). 3. If the size of HeaderView is smaller than the implicit size of the delegate, the delegate will simply be clipped. (effectivly saying that the implicitSize of the delegate is also it's minimum size). If this is not acceptable for the application, it will need to use a custom delegate. Since a HeaderView delegate is a component and not an item, it should not be a part of the sanity checks we do to avoid using internal IDs. Hence we blacklist until we have a better way of handling such cases. Task-number: QTPM-1300 Change-Id: I30ca3e13ce5e1371b60f5c4ecf742a7d7e794a36 Reviewed-by: Mitch Curtis --- src/imports/controls/HorizontalHeaderView.qml | 11 +++++++++-- src/imports/controls/VerticalHeaderView.qml | 11 +++++++++-- .../doc/snippets/qtquickcontrols2-headerview-simple.qml | 4 ---- src/imports/controls/fusion/HorizontalHeaderView.qml | 11 +++++++++-- src/imports/controls/fusion/VerticalHeaderView.qml | 11 +++++++++-- src/imports/controls/imagine/HorizontalHeaderView.qml | 11 +++++++++-- src/imports/controls/imagine/VerticalHeaderView.qml | 11 +++++++++-- src/imports/controls/material/HorizontalHeaderView.qml | 11 +++++++++-- src/imports/controls/material/VerticalHeaderView.qml | 11 +++++++++-- src/imports/controls/universal/HorizontalHeaderView.qml | 11 +++++++++-- src/imports/controls/universal/VerticalHeaderView.qml | 11 +++++++++-- 11 files changed, 90 insertions(+), 24 deletions(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/HorizontalHeaderView.qml b/src/imports/controls/HorizontalHeaderView.qml index 946d3a75..7f0454da 100644 --- a/src/imports/controls/HorizontalHeaderView.qml +++ b/src/imports/controls/HorizontalHeaderView.qml @@ -41,13 +41,20 @@ import QtQuick.Templates 2.15 as T T.HorizontalHeaderView { id: control + implicitWidth: syncView ? syncView.width : 0 + implicitHeight: contentHeight + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: text.implicitWidth + (cellPadding * 2) + implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) color: "#f6f6f6" border.color: "#e4e4e4" Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/VerticalHeaderView.qml b/src/imports/controls/VerticalHeaderView.qml index 67d4c1ce..5fbfaedf 100644 --- a/src/imports/controls/VerticalHeaderView.qml +++ b/src/imports/controls/VerticalHeaderView.qml @@ -41,13 +41,20 @@ import QtQuick.Templates 2.15 as T T.VerticalHeaderView { id: control + implicitWidth: contentWidth + implicitHeight: syncView ? syncView.height : 0 + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2)) + implicitHeight: text.implicitHeight + (cellPadding * 2) color: "#f6f6f6" border.color: "#e4e4e4" Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml index bea46bf3..07ec84d8 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml @@ -63,8 +63,6 @@ ApplicationWindow { id: horizontalHeader syncView: tableView anchors.left: tableView.left - width: parent.width - height: contentHeight } //! [horizontal] @@ -73,8 +71,6 @@ ApplicationWindow { id: verticalHeader syncView: tableView anchors.top: tableView.top - width: contentWidth - height: parent.height } //! [vertical] diff --git a/src/imports/controls/fusion/HorizontalHeaderView.qml b/src/imports/controls/fusion/HorizontalHeaderView.qml index 0be27642..3d0f247b 100644 --- a/src/imports/controls/fusion/HorizontalHeaderView.qml +++ b/src/imports/controls/fusion/HorizontalHeaderView.qml @@ -41,9 +41,15 @@ import QtQuick.Templates 2.15 as T T.HorizontalHeaderView { id: control + implicitWidth: syncView ? syncView.width : 0 + implicitHeight: contentHeight + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: text.implicitWidth + (cellPadding * 2) + implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) border.color: "#cacaca" gradient: Gradient { @@ -58,6 +64,7 @@ T.HorizontalHeaderView { } Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/fusion/VerticalHeaderView.qml b/src/imports/controls/fusion/VerticalHeaderView.qml index a9eadc23..5ad0db8f 100644 --- a/src/imports/controls/fusion/VerticalHeaderView.qml +++ b/src/imports/controls/fusion/VerticalHeaderView.qml @@ -41,9 +41,15 @@ import QtQuick.Templates 2.15 as T T.VerticalHeaderView { id: control + implicitWidth: contentWidth + implicitHeight: syncView ? syncView.height : 0 + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2)) + implicitHeight: text.implicitHeight + (cellPadding * 2) border.color: "#cacaca" gradient: Gradient { @@ -58,6 +64,7 @@ T.VerticalHeaderView { } Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/imagine/HorizontalHeaderView.qml b/src/imports/controls/imagine/HorizontalHeaderView.qml index 946d3a75..7f0454da 100644 --- a/src/imports/controls/imagine/HorizontalHeaderView.qml +++ b/src/imports/controls/imagine/HorizontalHeaderView.qml @@ -41,13 +41,20 @@ import QtQuick.Templates 2.15 as T T.HorizontalHeaderView { id: control + implicitWidth: syncView ? syncView.width : 0 + implicitHeight: contentHeight + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: text.implicitWidth + (cellPadding * 2) + implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) color: "#f6f6f6" border.color: "#e4e4e4" Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/imagine/VerticalHeaderView.qml b/src/imports/controls/imagine/VerticalHeaderView.qml index 67d4c1ce..5fbfaedf 100644 --- a/src/imports/controls/imagine/VerticalHeaderView.qml +++ b/src/imports/controls/imagine/VerticalHeaderView.qml @@ -41,13 +41,20 @@ import QtQuick.Templates 2.15 as T T.VerticalHeaderView { id: control + implicitWidth: contentWidth + implicitHeight: syncView ? syncView.height : 0 + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2)) + implicitHeight: text.implicitHeight + (cellPadding * 2) color: "#f6f6f6" border.color: "#e4e4e4" Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/material/HorizontalHeaderView.qml b/src/imports/controls/material/HorizontalHeaderView.qml index a1228cdc..504579cc 100644 --- a/src/imports/controls/material/HorizontalHeaderView.qml +++ b/src/imports/controls/material/HorizontalHeaderView.qml @@ -43,12 +43,19 @@ import QtQuick.Controls.Material.impl 2.15 T.HorizontalHeaderView { id: control + implicitWidth: syncView ? syncView.width : 0 + implicitHeight: contentHeight + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: text.implicitWidth + (cellPadding * 2) + implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) color: control.Material.backgroundColor Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/material/VerticalHeaderView.qml b/src/imports/controls/material/VerticalHeaderView.qml index 8acda3d7..7f8ecc92 100644 --- a/src/imports/controls/material/VerticalHeaderView.qml +++ b/src/imports/controls/material/VerticalHeaderView.qml @@ -43,12 +43,19 @@ import QtQuick.Controls.Material.impl 2.15 T.VerticalHeaderView { id: control + implicitWidth: contentWidth + implicitHeight: syncView ? syncView.height : 0 + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2)) + implicitHeight: text.implicitHeight + (cellPadding * 2) color: control.Material.backgroundColor Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/universal/HorizontalHeaderView.qml b/src/imports/controls/universal/HorizontalHeaderView.qml index 6f48560e..8cdfda35 100644 --- a/src/imports/controls/universal/HorizontalHeaderView.qml +++ b/src/imports/controls/universal/HorizontalHeaderView.qml @@ -44,12 +44,19 @@ import QtQuick.Controls.Universal.impl 2.15 T.HorizontalHeaderView { id: control + implicitWidth: syncView ? syncView.width : 0 + implicitHeight: contentHeight + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: text.implicitWidth + (cellPadding * 2) + implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) color: control.Universal.background Text { + id: text text: model[control.textRole] width: parent.width height: parent.height diff --git a/src/imports/controls/universal/VerticalHeaderView.qml b/src/imports/controls/universal/VerticalHeaderView.qml index 80133dbd..7c7544af 100644 --- a/src/imports/controls/universal/VerticalHeaderView.qml +++ b/src/imports/controls/universal/VerticalHeaderView.qml @@ -44,12 +44,19 @@ import QtQuick.Controls.Universal.impl 2.15 T.VerticalHeaderView { id: control + implicitWidth: contentWidth + implicitHeight: syncView ? syncView.height : 0 + delegate: Rectangle { - implicitWidth: 50 - implicitHeight: 25 + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2)) + implicitHeight: text.implicitHeight + (cellPadding * 2) color: control.Universal.background Text { + id: text text: model[control.textRole] width: parent.width height: parent.height -- cgit v1.2.3