From 208fa8f3e77f985eae6e4aa34fc0413ef66509c1 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Fri, 5 Jan 2024 09:58:25 +0200 Subject: [PATCH] QmlDesigner: Select columns by left click on Model Editor * HelperWidgets.ToolTip is replaced by ToolTip in order to prevent mouse are conflict * The content of the tooltip is updated by activation * CollectionDetailsModel notifies changes on column type Fixes: QDS-11591 Change-Id: I0b5e42b7a8656e3119f7ac60f6be78d6ca46e055 Reviewed-by: Qt CI Patch Build Bot Reviewed-by: Shrief Gabr Reviewed-by: Miikka Heikkinen --- .../CollectionDetailsView.qml | 17 ++++++++++++++--- .../collectioneditor/collectiondetailsmodel.cpp | 5 +++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml index e208553a4c5..42bb528c917 100644 --- a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml +++ b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml @@ -114,9 +114,12 @@ Rectangle { color: StudioTheme.Values.themeControlBackgroundInteraction MouseArea { + id: topHeaderMouseArea + anchors.fill: parent anchors.margins: 5 acceptedButtons: Qt.LeftButton | Qt.RightButton + hoverEnabled: true onClicked: (mouse) => { tableView.model.selectColumn(index) @@ -130,9 +133,17 @@ Rectangle { } } - HelperWidgets.ToolTipArea { - anchors.fill: parent - text: root.model.propertyType(index) + ToolTip { + id: topHeaderToolTip + + property bool expectedToBeShown: topHeaderMouseArea.containsMouse + visible: expectedToBeShown && text !== "" + delay: 1000 + + onExpectedToBeShownChanged: { + if (expectedToBeShown) + text = root.model.propertyType(index) + } } } diff --git a/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp b/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp index 2279b60d130..ccff8eb34e7 100644 --- a/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp +++ b/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp @@ -339,8 +339,9 @@ bool CollectionDetailsModel::setPropertyType(int column, const QString &newValue newValue)); if (changed) { emit headerDataChanged(Qt::Horizontal, column, column); - emit dataChanged(index(0, column), index(rowCount() - 1, column), - {Qt::DisplayRole, DataTypeRole, DataTypeWarningRole}); + emit dataChanged(index(0, column), + index(rowCount() - 1, column), + {Qt::DisplayRole, DataTypeRole, DataTypeWarningRole, ColumnDataTypeRole}); } return changed;