diff options
author | Liang Qi <liang.qi@qt.io> | 2019-07-04 13:35:55 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-07-04 13:35:55 +0200 |
commit | 5211cf2843af606b912e9130d44ee6c82eeb40b0 (patch) | |
tree | d2a90e480d497edc3bbac367bf974ec93076e409 | |
parent | 13bdd61c6597586f62558ca337c193ce03db26cc (diff) | |
parent | ce7c431fb23157fa5125d1102a594de045818a72 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
.qmake.conf
tests/auto/accessibility/tst_accessibility.cpp
Change-Id: I0bc187e2a8edb4e357c1bf114dd9b1977d5c1e45
-rw-r--r-- | dist/changes-5.12.4 | 20 | ||||
-rw-r--r-- | src/imports/controls/doc/qtquickcontrols.qdocconf | 4 | ||||
-rw-r--r-- | src/imports/controls/doc/src/qtquickcontrols2-index.qdoc | 2 | ||||
-rw-r--r-- | src/imports/controls/material/Button.qml | 3 | ||||
-rw-r--r-- | src/imports/controls/material/CursorDelegate.qml | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquickabstractbutton.cpp | 4 | ||||
-rw-r--r-- | src/quicktemplates2/qquickaction.cpp | 4 | ||||
-rw-r--r-- | src/quicktemplates2/qquickcheckbox.cpp | 7 | ||||
-rw-r--r-- | src/quicktemplates2/qquickcheckbox_p.h | 4 | ||||
-rw-r--r-- | src/quicktemplates2/qquickcontainer.cpp | 5 | ||||
-rw-r--r-- | src/quicktemplates2/qquickmenu.cpp | 13 | ||||
-rw-r--r-- | src/quicktemplates2/qquickrangeslider.cpp | 29 | ||||
-rw-r--r-- | src/quicktemplates2/qquickscrollview.cpp | 3 | ||||
-rw-r--r-- | tests/auto/accessibility/tst_accessibility.cpp | 4 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_action.qml | 29 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 58 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_tabbar.qml | 23 | ||||
-rw-r--r-- | tests/auto/qquickmenu/tst_qquickmenu.cpp | 5 |
18 files changed, 178 insertions, 41 deletions
diff --git a/dist/changes-5.12.4 b/dist/changes-5.12.4 new file mode 100644 index 00000000..a285cd8e --- /dev/null +++ b/dist/changes-5.12.4 @@ -0,0 +1,20 @@ +Qt 5.12.4 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.0 through 5.12.3. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.12 series is binary compatible with the 5.11.x series. +Applications compiled for 5.11 will continue to run with 5.12. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + + - This release contains only minor code improvements. diff --git a/src/imports/controls/doc/qtquickcontrols.qdocconf b/src/imports/controls/doc/qtquickcontrols.qdocconf index 2a01d058..fd921562 100644 --- a/src/imports/controls/doc/qtquickcontrols.qdocconf +++ b/src/imports/controls/doc/qtquickcontrols.qdocconf @@ -1,6 +1,8 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) include(manifest-meta.qdocconf) +moduleheader = QtQuickControls2 + project = QtQuickControls description = Qt Quick Controls Reference Documentation version = $QT_VERSION @@ -31,7 +33,7 @@ qhp.QtQuickControls.subprojects.examples.title = Examples qhp.QtQuickControls.subprojects.examples.indexTitle = Qt Quick Controls Examples qhp.QtQuickControls.subprojects.examples.selectors = fake:example -depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols1 qtquickextras qmake qtsql qtwidgets qtlabscalendar qtlabsplatform +depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols1 qtquickextras qmake qtsql qtwidgets qtlabscalendar qtlabsplatform qtgraphicaleffects # Specify the install path under QT_INSTALL_EXAMPLES # Note: paths passed to \example command must contain the parent directory, e.g. diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc index d425f421..452afb18 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc @@ -140,7 +140,7 @@ Furthermore Qt Quick Controls 2 potentially contains third party modules under following permissive licenses: - \generatelist{groupsbymodule attributions-qtquickcontrols2} + \generatelist{groupsbymodule attributions-qtquickcontrols} \section1 Topics diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml index 6f7d6c70..04c6664c 100644 --- a/src/imports/controls/material/Button.qml +++ b/src/imports/controls/material/Button.qml @@ -78,7 +78,6 @@ T.Button { control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.foreground } - // TODO: Add a proper ripple/ink effect for mouse/touch input and focus state background: Rectangle { implicitWidth: 64 implicitHeight: control.Material.buttonHeight @@ -113,7 +112,7 @@ T.Button { pressed: control.pressed anchor: control active: control.down || control.visualFocus || control.hovered - color: control.Material.rippleColor + color: control.flat && control.highlighted ? control.Material.highlightedRippleColor : control.Material.rippleColor } } } diff --git a/src/imports/controls/material/CursorDelegate.qml b/src/imports/controls/material/CursorDelegate.qml index f472e8ae..1626a6fb 100644 --- a/src/imports/controls/material/CursorDelegate.qml +++ b/src/imports/controls/material/CursorDelegate.qml @@ -55,7 +55,7 @@ Rectangle { Timer { id: timer - running: cursor.parent.activeFocus && !cursor.parent.readOnly + running: cursor.parent.activeFocus && !cursor.parent.readOnly && interval != 0 repeat: true interval: Qt.styleHints.cursorFlashTime / 2 onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0 diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp index a2992191..0aa8ec28 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -1157,6 +1157,10 @@ void QQuickAbstractButton::accessibilityActiveChanged(bool active) QAccessible::Role QQuickAbstractButton::accessibleRole() const { + Q_D(const QQuickAbstractButton); + if (d->checkable) { + return QAccessible::CheckBox; + } return QAccessible::Button; } #endif diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp index e83fd353..9120db37 100644 --- a/src/quicktemplates2/qquickaction.cpp +++ b/src/quicktemplates2/qquickaction.cpp @@ -185,7 +185,7 @@ void QQuickActionPrivate::setShortcut(const QVariant &var) for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(shortcutEntries)) entry->ungrab(); - vshortcut = var.toString(); + vshortcut = var; keySequence = variantToKeySequence(var); defaultShortcutEntry->grab(keySequence, enabled); @@ -487,7 +487,7 @@ void QQuickAction::setCheckable(bool checkable) \code Action { - sequence: "Ctrl+E,Ctrl+W" + shortcut: "Ctrl+E,Ctrl+W" onTriggered: edit.wrapMode = TextEdit.Wrap } \endcode diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp index 461fae30..0227e95d 100644 --- a/src/quicktemplates2/qquickcheckbox.cpp +++ b/src/quicktemplates2/qquickcheckbox.cpp @@ -243,13 +243,6 @@ void QQuickCheckBox::nextCheckState() QQuickAbstractButton::nextCheckState(); } -#if QT_CONFIG(accessibility) -QAccessible::Role QQuickCheckBox::accessibleRole() const -{ - return QAccessible::CheckBox; -} -#endif - QT_END_NAMESPACE #include "moc_qquickcheckbox_p.cpp" diff --git a/src/quicktemplates2/qquickcheckbox_p.h b/src/quicktemplates2/qquickcheckbox_p.h index 81bd680c..f0293c11 100644 --- a/src/quicktemplates2/qquickcheckbox_p.h +++ b/src/quicktemplates2/qquickcheckbox_p.h @@ -84,10 +84,6 @@ protected: void buttonChange(ButtonChange change) override; void nextCheckState() override; -#if QT_CONFIG(accessibility) - QAccessible::Role accessibleRole() const override; -#endif - private: Q_DISABLE_COPY(QQuickCheckBox) Q_DECLARE_PRIVATE(QQuickCheckBox) diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index 2c357f82..609c2079 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -294,8 +294,9 @@ void QQuickContainerPrivate::removeItem(int index, QQuickItem *item) updatingCurrent = true; + int count = contentModel->count(); bool currentChanged = false; - if (index == currentIndex) { + if (index == currentIndex && (index != 0 || count == 1)) { q->setCurrentIndex(currentIndex - 1); } else if (index < currentIndex) { --currentIndex; @@ -305,10 +306,10 @@ void QQuickContainerPrivate::removeItem(int index, QQuickItem *item) QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes); item->setParentItem(nullptr); contentModel->remove(index); + --count; q->itemRemoved(index, item); - int count = contentModel->count(); for (int i = index; i < count; ++i) q->itemMoved(i, itemAt(i)); diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp index aa44e845..82cc063f 100644 --- a/src/quicktemplates2/qquickmenu.cpp +++ b/src/quicktemplates2/qquickmenu.cpp @@ -173,6 +173,19 @@ static const int SUBMENU_DELAY = 225; \sa {Customizing Menu}, MenuItem, {Menu Controls}, {Popup Controls} */ +/*! + \qmlproperty bool QtQuick.Controls::Menu::focus + + This property holds whether the popup wants focus. + + When the popup actually receives focus, \l activeFocus will be \c true. + For more information, see \l {Keyboard Focus in Qt Quick}. + + The default value is \c false. + + \sa activeFocus +*/ + static const QQuickPopup::ClosePolicy cascadingSubMenuClosePolicy = QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutsideParent; static bool shouldCascade() diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index ff488dac..acf4dca3 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -752,7 +752,6 @@ qreal QQuickRangeSlider::valueAt(qreal position) const \qmlproperty bool QtQuick.Controls::RangeSlider::first.hovered \qmlproperty real QtQuick.Controls::RangeSlider::first.implicitHandleWidth \qmlproperty real QtQuick.Controls::RangeSlider::first.implicitHandleHeight - \qmlsignal void QtQuick.Controls::RangeSlider::moved() \table \header @@ -801,15 +800,9 @@ qreal QQuickRangeSlider::valueAt(qreal position) const \li implicitHandleHeight \li This property holds the implicit height of the first handle. This property was introduced in QtQuick.Controls 2.5. - \row - \li moved() - \li This signal is emitted when the first handle has been interactively moved - by the user by either touch, mouse, or keys. - - This signal was introduced in QtQuick.Controls 2.5. \endtable - \sa first.increase(), first.decrease() + \sa first.moved(), first.increase(), first.decrease() */ QQuickRangeSliderNode *QQuickRangeSlider::first() const { @@ -818,6 +811,17 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const } /*! + \qmlsignal void QtQuick.Controls::RangeSlider::first.moved() + \qmlsignal void QtQuick.Controls::RangeSlider::second.moved() + \since QtQuick.Controls 2.5 + + This signal is emitted when either the first or second handle has been + interactively moved by the user by either touch, mouse, or keys. + + \sa first, second +*/ + +/*! \qmlpropertygroup QtQuick.Controls::RangeSlider::second \qmlproperty real QtQuick.Controls::RangeSlider::second.value \qmlproperty real QtQuick.Controls::RangeSlider::second.position @@ -827,7 +831,6 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const \qmlproperty bool QtQuick.Controls::RangeSlider::second.hovered \qmlproperty real QtQuick.Controls::RangeSlider::second.implicitHandleWidth \qmlproperty real QtQuick.Controls::RangeSlider::second.implicitHandleHeight - \qmlsignal void QtQuick.Controls::RangeSlider::moved() \table \header @@ -876,15 +879,9 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const \li implicitHandleHeight \li This property holds the implicit height of the second handle. This property was introduced in QtQuick.Controls 2.5. - \row - \li moved() - \li This signal is emitted when the second handle has been interactively moved - by the user by either touch, mouse, or keys. - - This signal was introduced in QtQuick.Controls 2.5. \endtable - \sa second.increase(), second.decrease() + \sa second.moved(), second.increase(), second.decrease() */ QQuickRangeSliderNode *QQuickRangeSlider::second() const { diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp index c0f73692..98bd174e 100644 --- a/src/quicktemplates2/qquickscrollview.cpp +++ b/src/quicktemplates2/qquickscrollview.cpp @@ -78,7 +78,8 @@ QT_BEGIN_NAMESPACE \li If only a single item is used within a ScrollView, the content size is automatically calculated based on the implicit size of its contained item. However, if more than one item is used (or an implicit size is not - provided), the \l contentWidth and \l contentHeight properties must + provided), the \l {QtQuick.Controls::Pane::}{contentWidth} and + \l {QtQuick.Controls::Pane::}{contentHeight} properties must be set to the combined size of its contained items. \li If the content size is less than or equal to the size of the ScrollView, it will not be flickable. diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 87674a6b..868b4413 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -100,7 +100,7 @@ void tst_accessibility::a11y_data() QTest::newRow("StackView") << "stackview" << QAccessible::LayeredPane << ""; QTest::newRow("SwipeDelegate") << "swipedelegate" << QAccessible::ListItem << "SwipeDelegate"; QTest::newRow("SwipeView") << "swipeview" << QAccessible::PageTabList << ""; - QTest::newRow("Switch") << "switch" << QAccessible::Button << "Switch"; + QTest::newRow("Switch") << "switch" << QAccessible::CheckBox << "Switch"; QTest::newRow("SwitchDelegate") << "switchdelegate" << QAccessible::ListItem << "SwitchDelegate"; QTest::newRow("TabBar") << "tabbar" << QAccessible::PageTabList << ""; QTest::newRow("TabButton") << "tabbutton" << QAccessible::PageTab << "TabButton"; @@ -109,7 +109,7 @@ void tst_accessibility::a11y_data() QTest::newRow("ToolBar") << "toolbar" << QAccessible::ToolBar << ""; QTest::newRow("ToolButton") << "toolbutton" << QAccessible::Button << "ToolButton"; QTest::newRow("ToolTip") << "tooltip" << QAccessible::ToolTip << "ToolTip"; - QTest::newRow("Tumbler") << "tumbler" << QAccessible::NoRole << ""; // (TODO) + QTest::newRow("Tumbler") << "tumbler" << QAccessible::NoRole << ""; // TODO QTest::newRow("DayOfWeekRow") << "dayofweekrow" << QAccessible::NoRole << "DayOfWeekRow"; QTest::newRow("MonthGrid") << "monthgrid" << QAccessible::NoRole << "MonthGrid"; diff --git a/tests/auto/controls/data/tst_action.qml b/tests/auto/controls/data/tst_action.qml index ef28c0e5..0e41b7f3 100644 --- a/tests/auto/controls/data/tst_action.qml +++ b/tests/auto/controls/data/tst_action.qml @@ -165,4 +165,33 @@ TestCase { keyClick(Qt.Key_A, Qt.ControlModifier) compare(spy.count, 1) } + + Component { + id: shortcutBinding + Item { + Action { + id: action + shortcut: StandardKey.Copy + } + + Shortcut { + id: indirectShortcut + sequence: action.shortcut + } + + Shortcut { + id: directShortcut + sequence: StandardKey.Copy + } + + property alias indirect: indirectShortcut; + property alias direct: directShortcut + } + } + + function test_shortcutBinding() { + var container = createTemporaryObject(shortcutBinding, testCase); + verify(container) + compare(container.indirect.nativeText, container.direct.nativeText); + } } diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 0d266e1a..f8f06679 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -96,6 +96,45 @@ TestCase { } } + Component { + id: comboBoxWithShaderEffect + ComboBox { + delegate: Rectangle { + Text { + id: txt + anchors.centerIn: parent + text: "item" + index + font.pixelSize: 20 + color: "red" + } + id: rect + objectName: "rect" + width: parent.width + height: txt.implicitHeight + gradient: Gradient { + GradientStop { color: "lightsteelblue"; position: 0.0 } + GradientStop { color: "blue"; position: 1.0 } + } + layer.enabled: true + layer.effect: ShaderEffect { + objectName: "ShaderFX" + width: rect.width + height: rect.height + fragmentShader: " + uniform lowp sampler2D source; // this item + uniform lowp float qt_Opacity; // inherited opacity of this item + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 p = texture2D(source, qt_TexCoord0); + lowp float g = dot(p.xyz, vec3(0.344, 0.5, 0.156)); + gl_FragColor = vec4(g, g, g, p.a) * qt_Opacity; + }" + + } + } + } + } + function init() { // QTBUG-61225: Move the mouse away to avoid QQuickWindowPrivate::flushFrameSynchronousEvents() // delivering interfering hover events based on the last mouse position from earlier tests. For @@ -1731,4 +1770,23 @@ TestCase { closedSpy.wait() compare(closedSpy.count, 1) } + + function test_comboBoxWithShaderEffect() { + var control = createTemporaryObject(comboBoxWithShaderEffect, testCase, {model: 9}) + verify(control) + waitForRendering(control) + control.forceActiveFocus() + var openedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "opened"}) + verify(openedSpy.valid) + + var closedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "closed"}) + verify(closedSpy.valid) + + control.popup.open() + openedSpy.wait() + compare(openedSpy.count, 1) + control.popup.close() + closedSpy.wait() + compare(closedSpy.count, 1) + } } diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml index 519b1d53..42e767f2 100644 --- a/tests/auto/controls/data/tst_tabbar.qml +++ b/tests/auto/controls/data/tst_tabbar.qml @@ -270,6 +270,29 @@ TestCase { compare(contentChildrenSpy.count, 12) } + function test_removeCurrent() { + var control = createTemporaryObject(tabBar, testCase) + + control.addItem(tabButton.createObject(control, {text: "1"})) + control.addItem(tabButton.createObject(control, {text: "2"})) + control.addItem(tabButton.createObject(control, {text: "3"})) + control.currentIndex = 1 + compare(control.count, 3) + compare(control.currentIndex, 1) + + control.removeItem(1) + compare(control.count, 2) + compare(control.currentIndex, 0) + + control.removeItem(0) + compare(control.count, 1) + compare(control.currentIndex, 0) + + control.removeItem(0) + compare(control.count, 0) + compare(control.currentIndex, -1) + } + Component { id: contentBar TabBar { diff --git a/tests/auto/qquickmenu/tst_qquickmenu.cpp b/tests/auto/qquickmenu/tst_qquickmenu.cpp index 49fdc066..f22ac972 100644 --- a/tests/auto/qquickmenu/tst_qquickmenu.cpp +++ b/tests/auto/qquickmenu/tst_qquickmenu.cpp @@ -1105,8 +1105,9 @@ void tst_QQuickMenu::subMenuMouse() QCOMPARE(mainMenu->isVisible(), cascade); QVERIFY(subMenu1->isVisible()); QVERIFY(!subMenu2->isVisible()); - QVERIFY(!subSubMenu1->isVisible()); - if (cascade) { + if (!cascade) { + QVERIFY(!subSubMenu1->isVisible()); + } else { QTRY_VERIFY(subSubMenu1->isVisible()); QTRY_VERIFY(subSubMenu1->isOpened()); } |