diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-06 11:56:59 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-06 13:46:52 +0200 |
commit | 72149cbb6fe7b1e6af4018c945ece738f8ad0a10 (patch) | |
tree | 86f82f0fa9480dc51c492470c4fe76879150c84a | |
parent | f834d604ab58050f559f4938eff47b1ca1ba7ab8 (diff) | |
parent | 4310e5efe36ed7136aa928134c5b6b95d4bd636a (diff) |
Merge "Merge remote-tracking branch 'origin/5.15' into dev"
11 files changed, 94 insertions, 46 deletions
diff --git a/examples/quickcontrols2/contactlist/ContactView.ui.qml b/examples/quickcontrols2/contactlist/ContactView.ui.qml index 747f3042..984fc787 100644 --- a/examples/quickcontrols2/contactlist/ContactView.ui.qml +++ b/examples/quickcontrols2/contactlist/ContactView.ui.qml @@ -72,11 +72,7 @@ ListView { delegate: ContactDelegate { id: delegate width: listView.width - - Connections { - target: delegate - onPressAndHold: listView.pressAndHold(index) - } + onPressAndHold: listView.pressAndHold(index) } model: ContactModel { diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml index e9f0b432..44987ada 100644 --- a/examples/quickcontrols2/gallery/gallery.qml +++ b/examples/quickcontrols2/gallery/gallery.qml @@ -70,15 +70,31 @@ ApplicationWindow { Shortcut { sequences: ["Esc", "Back"] enabled: stackView.depth > 1 - onActivated: { - stackView.pop() - listView.currentIndex = -1 + onActivated: navigateBackAction.trigger() + } + + Action { + id: navigateBackAction + icon.name: stackView.depth > 1 ? "back" : "drawer" + onTriggered: { + if (stackView.depth > 1) { + stackView.pop() + listView.currentIndex = -1 + } else { + drawer.open() + } } } Shortcut { sequence: "Menu" - onActivated: optionsMenu.open() + onActivated: optionsMenuAction.trigger() + } + + Action { + id: optionsMenuAction + icon.name: "menu" + onTriggered: optionsMenu.open() } header: ToolBar { @@ -89,15 +105,7 @@ ApplicationWindow { anchors.fill: parent ToolButton { - icon.name: stackView.depth > 1 ? "back" : "drawer" - onClicked: { - if (stackView.depth > 1) { - stackView.pop() - listView.currentIndex = -1 - } else { - drawer.open() - } - } + action: navigateBackAction } Label { @@ -111,19 +119,18 @@ ApplicationWindow { } ToolButton { - icon.name: "menu" - onClicked: optionsMenu.open() + action: optionsMenuAction Menu { id: optionsMenu x: parent.width - width transformOrigin: Menu.TopRight - MenuItem { + Action { text: "Settings" onTriggered: settingsDialog.open() } - MenuItem { + Action { text: "About" onTriggered: aboutDialog.open() } diff --git a/examples/quickcontrols2/gallery/pages/TabBarPage.qml b/examples/quickcontrols2/gallery/pages/TabBarPage.qml index 7f5cbce5..7c3cae44 100644 --- a/examples/quickcontrols2/gallery/pages/TabBarPage.qml +++ b/examples/quickcontrols2/gallery/pages/TabBarPage.qml @@ -74,7 +74,7 @@ Page { width: parent.width wrapMode: Label.Wrap horizontalAlignment: Qt.AlignHCenter - text: "TabBar is a bar with icons or text which allows the user" + text: "TabBar is a bar with icons or text which allows the user " + "to switch between different subtasks, views, or modes." } diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-accepted.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-accepted.qml new file mode 100644 index 00000000..9f2ad928 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-accepted.qml @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Controls 2.12 + +//! [combobox] +ComboBox { + editable: true + model: ListModel { + id: model + ListElement { text: "Banana" } + ListElement { text: "Apple" } + ListElement { text: "Coconut" } + } + onAccepted: { + if (find(editText) === -1) + model.append({text: editText}) + } +} +//! [combobox] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml index 1bb68bdf..b902dab1 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml @@ -55,7 +55,7 @@ ComboBox { Connections { target: control - onPressedChanged: canvas.requestPaint() + function onPressedChanged() { canvas.requestPaint(); } } onPaint: { diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-delaybutton-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-delaybutton-custom.qml index 86c6a0b7..4bcbaa67 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-delaybutton-custom.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-delaybutton-custom.qml @@ -62,7 +62,7 @@ DelayButton { Connections { target: control - onProgressChanged: canvas.requestPaint() + function onProgressChanged() { canvas.requestPaint(); } } onPaint: { diff --git a/src/imports/controls/doc/src/qtquickcontrols2-navigation.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-navigation.qdoc index 7cc84ed6..ce4a6eae 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-navigation.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-navigation.qdoc @@ -55,7 +55,7 @@ scrolling. The page indicator on the bottom shows which is the presently active page. - \section1 TabBar + \section1 TabBar Control \image qtquickcontrols2-tabbar-wireframe.png diff --git a/src/imports/controls/material/CursorDelegate.qml b/src/imports/controls/material/CursorDelegate.qml index 1626a6fb..fe2d25c6 100644 --- a/src/imports/controls/material/CursorDelegate.qml +++ b/src/imports/controls/material/CursorDelegate.qml @@ -46,7 +46,7 @@ Rectangle { Connections { target: cursor.parent - onCursorPositionChanged: { + function onCursorPositionChanged() { // keep a moving cursor visible cursor.opacity = 1 timer.restart() diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 71b4eaf1..5c38a7ac 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -90,21 +90,7 @@ QT_BEGIN_NAMESPACE The following example demonstrates appending content to an editable combo box by reacting to the \l accepted signal. - \code - ComboBox { - editable: true - model: ListModel { - id: model - ListElement { text: "Banana" } - ListElement { text: "Apple" } - ListElement { text: "Coconut" } - } - onAccepted: { - if (find(editText) === -1) - model.append({text: editText}) - } - } - \endcode + \snippet qtquickcontrols2-combobox-accepted.qml combobox \section1 ComboBox Model Roles @@ -163,9 +149,22 @@ QT_BEGIN_NAMESPACE \qmlsignal void QtQuick.Controls::ComboBox::accepted() This signal is emitted when the \uicontrol Return or \uicontrol Enter key is pressed - on an \l editable combo box. If the confirmed string is not currently in the model, - the \l currentIndex will be set to \c -1 and the \l currentText will be updated - accordingly. + on an \l editable combo box. + + You can handle this signal in order to add the newly entered + item to the model, for example: + + \snippet qtquickcontrols2-combobox-accepted.qml combobox + + Before the signal is emitted, a check is done to see if the string + exists in the model. If it does, \l currentIndex will be set to its index, + and \l currentText to the string itself. + + After the signal has been emitted, and if the first check failed (that is, + the item did not exist), another check will be done to see if the item was + added by the signal handler. If it was, the \l currentIndex and + \l currentText are updated accordingly. Otherwise, they will be set to + \c -1 and \c "", respectively. \note If there is a \l validator set on the combo box, the signal will only be emitted if the input is in an acceptable state. diff --git a/src/quicktemplates2/qquickoverlay_p.h b/src/quicktemplates2/qquickoverlay_p.h index 0d8bccf5..1d238163 100644 --- a/src/quicktemplates2/qquickoverlay_p.h +++ b/src/quicktemplates2/qquickoverlay_p.h @@ -86,7 +86,7 @@ Q_SIGNALS: protected: void itemChange(ItemChange change, const ItemChangeData &data) override; - void geometryChanged(const QRectF &oldGeometry, const QRectF &newGeometry) override; + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index dd7dede6..f0cf1869 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -2582,6 +2582,7 @@ void QQuickPopup::itemChange(QQuickItem::ItemChange change, const QQuickItem::It else d->popupItem->ungrabShortcut(); } + break; default: break; } |