diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-06-29 20:11:01 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-06-29 20:11:01 +0200 |
commit | b67921267c7ab4faea0e21e98573974ef82634aa (patch) | |
tree | 9dd2f1043458ea6d5ed846f739376d58db4c36fc | |
parent | a32786e6e586a05f3935e013022574b4dc18f828 (diff) | |
parent | d48cd2c203a14b0e61255f0efb28d990f1847911 (diff) | |
download | qtquickcontrols-b67921267c7ab4faea0e21e98573974ef82634aa.tar.gz |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
.qmake.conf
Change-Id: I8a32df546611d7a8105ad31ed72f54dbac0b1250
-rw-r--r-- | dist/changes-5.5.0 | 75 | ||||
-rw-r--r-- | examples/quick/controls/filesystembrowser/main.qml | 9 | ||||
-rw-r--r-- | src/controls/ComboBox.qml | 2 | ||||
-rw-r--r-- | src/controls/Private/BasicTableView.qml | 2 | ||||
-rw-r--r-- | src/controls/Private/EditMenu_ios.qml | 48 | ||||
-rw-r--r-- | src/controls/Private/TextInputWithHandles.qml | 1 | ||||
-rw-r--r-- | src/controls/Private/TextSingleton.qml | 21 | ||||
-rw-r--r-- | src/controls/Private/qquicksceneposlistener.cpp | 8 | ||||
-rw-r--r-- | src/controls/Styles/Base/ScrollViewStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/TextArea.qml | 1 | ||||
-rw-r--r-- | src/dialogs/qquickdialog.cpp | 10 | ||||
-rw-r--r-- | src/dialogs/qquickplatformfiledialog.cpp | 1 | ||||
-rw-r--r-- | src/extras/StatusIndicator.qml | 1 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 11 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_tableview.qml | 26 |
15 files changed, 142 insertions, 76 deletions
diff --git a/dist/changes-5.5.0 b/dist/changes-5.5.0 new file mode 100644 index 00000000..3dfa2ae6 --- /dev/null +++ b/dist/changes-5.5.0 @@ -0,0 +1,75 @@ +Qt 5.5 introduces many new features and improvements as well as bugfixes +over the 5.4.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + + http://doc.qt.io/qt-5/index.html + +The Qt version 5.5 series is binary compatible with the 5.4.x series. +Applications compiled for 5.4 will continue to run with 5.5. + +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. + +**************************************************************************** +* Controls * +**************************************************************************** + + - Menu: + * [QTBUG-40576] Added aboutToShow, aboutToHide signals + * Added Undo, Redo, Delete, Clear and Select All actions to EditMenu + + - SplitView: + * [QTBUG-42509] Added remove() function + + - TableView: + * [QTBUG-44246] "model" property exposed to rowDelegate is now consistent + with ListView behavior + + - TextField: + * [QTBUG-40735] Added remove() function + + - TreeView: + * Introduced TreeView + +**************************************************************************** +* Dialogs * +**************************************************************************** + + - General: + * Added fallback to QML if the helper fails to show the native dialog at + runtime. + + - FileDialog: + * Added FileDialog.shortcuts to enable setting the starting folder to a + standard system path. Setting folder to shortcuts.pictures will result + in a special image gallery dialog on iOS. + + - FontDialog: + * [QTBUG-46044] Added support for more font.weight enum values + * Internationalized the names of font.weight enums + +**************************************************************************** +* Layouts * +**************************************************************************** + + - [QTBUG-39724][QTBUG-41559] Added support for Layout margins + +**************************************************************************** +* Styles * +**************************************************************************** + + - Merged Extras' styling system into Controls'. + +**************************************************************************** +* Extras * +**************************************************************************** + + - Imported Qt Quick Extras (the former Qt Quick Enterprise Controls) + + - ToggleButton: + * Corrected text color diff --git a/examples/quick/controls/filesystembrowser/main.qml b/examples/quick/controls/filesystembrowser/main.qml index 4b182b73..454a9f31 100644 --- a/examples/quick/controls/filesystembrowser/main.qml +++ b/examples/quick/controls/filesystembrowser/main.qml @@ -83,12 +83,6 @@ ApplicationWindow { ItemSelectionModel { id: sel model: fileSystemModel - onSelectionChanged: { - console.log("selected", selected) - console.log("deselected", deselected) - console.log("selection", sel.selection()) - } - onCurrentChanged: console.log("current", current) } TreeView { @@ -98,8 +92,6 @@ ApplicationWindow { model: fileSystemModel selection: sel - onCurrentIndexChanged: console.log("current index", currentIndex) - TableViewColumn { title: "Name" role: "fileName" @@ -112,7 +104,6 @@ ApplicationWindow { resizable: true } - onClicked: console.log("clicked", index) onDoubleClicked: isExpanded(index) ? collapse(index) : expand(index) } } diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index 509a4b3d..3463470f 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -642,7 +642,7 @@ Control { var selectedItem; if (__selectedIndex !== -1 && (selectedItem = items[__selectedIndex])) { input.editTextMatches = true - selectedText = selectedItem.text + selectedText = Qt.binding(function () { return selectedItem.text }) if (currentText !== selectedText) // __selectedIndex went form -1 to 0 selectedTextChanged() } diff --git a/src/controls/Private/BasicTableView.qml b/src/controls/Private/BasicTableView.qml index 518f43af..4e1c45ab 100644 --- a/src/controls/Private/BasicTableView.qml +++ b/src/controls/Private/BasicTableView.qml @@ -346,7 +346,7 @@ ScrollView { frameVisible: true __scrollBarTopMargin: (__style && __style.transientScrollBars || Qt.platform.os === "osx") ? headerrow.height : 0 - __viewTopMargin: headerrow.height + __viewTopMargin: headerVisible ? headerrow.height : 0 /*! \internal Use this to display user-friendly messages in TableView and TreeView common functions. diff --git a/src/controls/Private/EditMenu_ios.qml b/src/controls/Private/EditMenu_ios.qml index bbd25e1b..7b0787f0 100644 --- a/src/controls/Private/EditMenu_ios.qml +++ b/src/controls/Private/EditMenu_ios.qml @@ -41,7 +41,7 @@ import QtQuick.Controls.Private 1.0 Item { anchors.fill: parent - property bool __showMenuFromTouchAndHold: false + property bool __showMenuFromTouch: false property Component defaultMenu: Menu { MenuItem { @@ -85,46 +85,25 @@ Item { Connections { target: mouseArea - function clearFocusFromOtherItems() - { - var selectionItem = TextSingleton.selectionItem; - if (!selectionItem) - return; - var otherPos = selectionItem.cursorPosition; - selectionItem.select(otherPos, otherPos) - } - onClicked: { - if (control.menu && getMenuInstance().__popupVisible) { - select(input.cursorPosition, input.cursorPosition); - } else { + var pos = input.positionAt(mouse.x, mouse.y); + var posMoved = (pos !== input.cursorPosition); + var popupVisible = (control.menu && getMenuInstance().__popupVisible); + + if (!input.activeFocus) input.activate(); - clearFocusFromOtherItems(); - } + else if (!popupVisible && !posMoved) + __showMenuFromTouch = true; - if (input.activeFocus) { - var pos = input.positionAt(mouse.x, mouse.y) - input.moveHandles(pos, pos) - } + input.moveHandles(pos, pos) + menuTimer.start(); } onPressAndHold: { - var pos = input.positionAt(mouseArea.mouseX, mouseArea.mouseY); - input.select(pos, pos); - var hasSelection = selectionStart != selectionEnd; - if (!control.menu || (input.length > 0 && (!input.activeFocus || hasSelection))) { - selectWord(); - } else { - // We don't select anything at this point, the - // menu will instead offer to select a word. - __showMenuFromTouchAndHold = true; - menuTimer.start(); - clearFocusFromOtherItems(); - } + __showMenuFromTouch = true; + menuTimer.start(); } - onReleased: __showMenuFromTouchAndHold = false - onCanceled: __showMenuFromTouchAndHold = false } Connections { @@ -166,7 +145,7 @@ Item { if (!control.menu) return; - if ((__showMenuFromTouchAndHold || selectionStart !== selectionEnd) + if ((__showMenuFromTouch || selectionStart !== selectionEnd) && control.activeFocus && (!cursorHandle.pressed && !selectionHandle.pressed) && (!flickable || !flickable.moving) @@ -178,6 +157,7 @@ Item { var targetRect = Qt.rect(topLeft.x, topLeft.y, size.width, size.height); getMenuInstance().__dismissMenu(); getMenuInstance().__popup(targetRect, -1, MenuPrivate.EditMenu); + __showMenuFromTouch = false; } else { getMenuInstance().__dismissMenu(); } diff --git a/src/controls/Private/TextInputWithHandles.qml b/src/controls/Private/TextInputWithHandles.qml index 1c40f588..42e7fde0 100644 --- a/src/controls/Private/TextInputWithHandles.qml +++ b/src/controls/Private/TextInputWithHandles.qml @@ -72,7 +72,6 @@ TextInput { selectionHandle.position = (selectionStart !== cursorPosition) ? selectionStart : selectionEnd blockRecursion = false } - TextSingleton.updateSelectionItem(input) } function activate() { diff --git a/src/controls/Private/TextSingleton.qml b/src/controls/Private/TextSingleton.qml index da616367..29161354 100644 --- a/src/controls/Private/TextSingleton.qml +++ b/src/controls/Private/TextSingleton.qml @@ -37,25 +37,4 @@ pragma Singleton import QtQuick 2.2 Text { - /** - selectionItem is the item that currently has a text selection. On some platforms - (iOS) you can select text without activating the input field. This means that - selectionItem can be different from item with active focus on those platforms. - */ - property Item selectionItem: null - - function updateSelectionItem(item) - { - // Convenience function to check if we should transfer or - // remove selectionItem status from item. - var selection = item.selectionStart !== item.selectionEnd - if (item === selectionItem) { - if (!selection) - selectionItem = null - } else if (selection) { - if (selectionItem) - selectionItem.select(selectionItem.cursorPosition, selectionItem.cursorPosition) - selectionItem = item - } - } } diff --git a/src/controls/Private/qquicksceneposlistener.cpp b/src/controls/Private/qquicksceneposlistener.cpp index d6155fe1..6bcc1deb 100644 --- a/src/controls/Private/qquicksceneposlistener.cpp +++ b/src/controls/Private/qquicksceneposlistener.cpp @@ -128,8 +128,6 @@ void QQuickScenePosListener::itemGeometryChanged(QQuickItem *, const QRectF &, c void QQuickScenePosListener::itemParentChanged(QQuickItem *, QQuickItem *parent) { - Q_ASSERT(m_item == parent); - addAncestorListeners(parent); } @@ -165,7 +163,8 @@ void QQuickScenePosListener::updateScenePos() */ void QQuickScenePosListener::removeAncestorListeners(QQuickItem *item) { - Q_ASSERT(item != m_item); + if (item == m_item) + return; QQuickItem *p = item; while (p != 0) { @@ -181,7 +180,8 @@ void QQuickScenePosListener::removeAncestorListeners(QQuickItem *item) */ void QQuickScenePosListener::addAncestorListeners(QQuickItem *item) { - Q_ASSERT(item != m_item); + if (item == m_item) + return; QQuickItem *p = item; while (p != 0) { diff --git a/src/controls/Styles/Base/ScrollViewStyle.qml b/src/controls/Styles/Base/ScrollViewStyle.qml index 091761ac..f3478646 100644 --- a/src/controls/Styles/Base/ScrollViewStyle.qml +++ b/src/controls/Styles/Base/ScrollViewStyle.qml @@ -65,7 +65,7 @@ Style { appear when the content is scrolled and disappear when they are no longer needed. The default value is platform dependent. */ - property bool transientScrollBars: !Settings.isMobile && Settings.hasTouchScreen + property bool transientScrollBars: Settings.isMobile && Settings.hasTouchScreen /*! This Component paints the frame around scroll bars. */ property Component frame: Rectangle { diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index d79b7c0f..87b13e0d 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -807,7 +807,6 @@ ScrollView { blockRecursion = false } ensureVisible(cursorRectangle) - TextSingleton.updateSelectionItem(area) } function ensureVisible(rect) { diff --git a/src/dialogs/qquickdialog.cpp b/src/dialogs/qquickdialog.cpp index 3ebd9aef..6a4a0721 100644 --- a/src/dialogs/qquickdialog.cpp +++ b/src/dialogs/qquickdialog.cpp @@ -338,27 +338,31 @@ void QQuickDialog::setStandardButtons(StandardButtons buttons) void QQuickDialog::click(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role) { - setVisible(false); m_clickedButton = static_cast<StandardButton>(button); emit buttonClicked(); switch (role) { case QPlatformDialogHelper::AcceptRole: - emit accept(); + emit accepted(); + setVisible(false); break; case QPlatformDialogHelper::RejectRole: - emit reject(); + emit rejected(); + setVisible(false); break; case QPlatformDialogHelper::DestructiveRole: emit discard(); + setVisible(false); break; case QPlatformDialogHelper::HelpRole: emit help(); break; case QPlatformDialogHelper::YesRole: emit yes(); + setVisible(false); break; case QPlatformDialogHelper::NoRole: emit no(); + setVisible(false); break; case QPlatformDialogHelper::ApplyRole: emit apply(); diff --git a/src/dialogs/qquickplatformfiledialog.cpp b/src/dialogs/qquickplatformfiledialog.cpp index afab95fb..ab9ba72d 100644 --- a/src/dialogs/qquickplatformfiledialog.cpp +++ b/src/dialogs/qquickplatformfiledialog.cpp @@ -209,6 +209,7 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() ->createPlatformDialogHelper(QPlatformTheme::FileDialog)); if (!m_dlgHelper) return m_dlgHelper; + m_dlgHelper->setOptions(m_options); connect(m_dlgHelper, SIGNAL(directoryEntered(QUrl)), this, SIGNAL(folderChanged())); connect(m_dlgHelper, SIGNAL(filterSelected(QString)), this, SIGNAL(filterSelected())); connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept())); diff --git a/src/extras/StatusIndicator.qml b/src/extras/StatusIndicator.qml index 7348833d..df76a3d4 100644 --- a/src/extras/StatusIndicator.qml +++ b/src/extras/StatusIndicator.qml @@ -35,6 +35,7 @@ ****************************************************************************/ import QtQuick 2.2 +import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 import QtQuick.Extras 1.4 diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index b6eaaf6d..af1fc9dd 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -743,5 +743,16 @@ TestCase { test.destroy() } + + function test_modelDataChange() { + var comboBox = Qt.createQmlObject('import QtQuick.Controls 1.2 ; ComboBox {}', testCase, ''); + comboBox.textRole = "text" + comboBox.model = model + compare(comboBox.currentIndex, 0) + compare(comboBox.currentText, "Banana") + model.set(0, { text: "Pomegranate", color: "Yellow" }) + compare(comboBox.currentText, "Pomegranate") + comboBox.destroy() + } } } diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml index 468c7eeb..9bb2cd67 100644 --- a/tests/auto/controls/data/tst_tableview.qml +++ b/tests/auto/controls/data/tst_tableview.qml @@ -69,6 +69,32 @@ TestCase { ] } + function test_QTBUG_46468() { + var table = Qt.createQmlObject('import QtQuick.Controls 1.3; \n\ + import QtQuick 2.4; \n\ + TableView { \n\ + headerVisible: false; \n\ + TableViewColumn{} \n\ + model: 10; \n\ + }', testCase, '') + wait(50); + verify(table.__viewTopMargin === 0) + table.destroy() + } + + function test_headervisible() { + var table = Qt.createQmlObject('import QtQuick.Controls 1.3; \n\ + import QtQuick 2.4; \n\ + TableView { \n\ + headerVisible: true; \n\ + TableViewColumn{} \n\ + model: 10; \n\ + }', testCase, '') + wait(50); + verify(table.__viewTopMargin > 0) + table.destroy() + } + function test_basic_setup() { var test_instanceStr = 'import QtQuick 2.2; \ |