diff options
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/Private/TableViewItemDelegateLoader.qml | 5 | ||||
-rw-r--r-- | src/controls/TreeView.qml | 22 | ||||
-rw-r--r-- | src/controls/doc/src/qtquickcontrols-index.qdoc | 2 | ||||
-rw-r--r-- | src/controls/doc/src/qtquickcontrolsstyles-index.qdoc | 2 |
4 files changed, 24 insertions, 7 deletions
diff --git a/src/controls/Private/TableViewItemDelegateLoader.qml b/src/controls/Private/TableViewItemDelegateLoader.qml index 544b08f8..462a2bb4 100644 --- a/src/controls/Private/TableViewItemDelegateLoader.qml +++ b/src/controls/Private/TableViewItemDelegateLoader.qml @@ -65,7 +65,9 @@ Loader { width: __column ? __column.width : 0 height: parent ? parent.height : 0 visible: __column ? __column.visible : false - sourceComponent: __model === undefined || styleData.row === -1 ? null + + property bool isValid: false + sourceComponent: (__model === undefined || !isValid) ? null : __column && __column.delegate ? __column.delegate : __itemDelegate // All these properties are internal @@ -95,5 +97,6 @@ Loader { readonly property var value: model && model.hasOwnProperty(role) ? model[role] // Qml ListModel and QAbstractItemModel : modelData && modelData.hasOwnProperty(role) ? modelData[role] // QObjectList / QObject : modelData != undefined ? modelData : "" // Models without role + onRowChanged: if (row !== -1) itemDelegateLoader.isValid = true } } diff --git a/src/controls/TreeView.qml b/src/controls/TreeView.qml index aa21acc1..6a38acff 100644 --- a/src/controls/TreeView.qml +++ b/src/controls/TreeView.qml @@ -118,8 +118,8 @@ BasicTableView { z: -1 propagateComposedEvents: true focus: true - // Note: with boolean preventStealing we are keeping - // the flickable from eating our mouse press events + // If there is not a touchscreen, keep the flickable from eating our mouse drags. + // If there is a touchscreen, flicking is possible, but selection can be done only by tapping, not by dragging. preventStealing: !Settings.hasTouchScreen property var clickedIndex: undefined @@ -323,8 +323,22 @@ BasicTableView { modelAdaptor.collapse(modelIndex) else modelAdaptor.expand(modelIndex) - } else if (root.__activateItemOnSingleClick) { - root.activated(modelIndex) + } else { + if (Settings.hasTouchScreen) { + // compensate for the fact that onPressed didn't select on press: do it here instead + pressedIndex = modelAdaptor.mapRowToModelIndex(clickIndex) + pressedColumn = __listView.columnAt(mouseX) + selectOnRelease = false + __listView.forceActiveFocus() + __listView.currentIndex = clickIndex + if (!clickedIndex) + clickedIndex = pressedIndex + mouseSelect(pressedIndex, mouse.modifiers, false) + if (!mouse.modifiers) + clickedIndex = pressedIndex + } + if (root.__activateItemOnSingleClick && !mouse.modifiers) + root.activated(modelIndex) } root.clicked(modelIndex) } diff --git a/src/controls/doc/src/qtquickcontrols-index.qdoc b/src/controls/doc/src/qtquickcontrols-index.qdoc index 2dc7d13b..63753ae1 100644 --- a/src/controls/doc/src/qtquickcontrols-index.qdoc +++ b/src/controls/doc/src/qtquickcontrols-index.qdoc @@ -34,7 +34,7 @@ The Qt Quick Controls module provides a set of controls that can be used to build complete interfaces in Qt Quick. - The module is new in Qt 5.1. + The module was introduced in Qt 5.1. Visit the \l{Qt Quick Controls Overview} page to get started. diff --git a/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc b/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc index 69180295..100868a9 100644 --- a/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc +++ b/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc @@ -62,7 +62,7 @@ The Qt Quick Controls Styles submodule allows custom styling for \l {Qt Quick Controls}. - The submodule is new in Qt 5.1. + The submodule was introduced in Qt 5.1. \section1 Getting started |