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 <ci_patchbuild_bot@qt.io>
Reviewed-by: Shrief Gabr <shrief.gabr@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Ali Kianian
2024-01-05 09:58:25 +02:00
parent fdcb29c711
commit 208fa8f3e7
2 changed files with 17 additions and 5 deletions

View File

@@ -114,9 +114,12 @@ Rectangle {
color: StudioTheme.Values.themeControlBackgroundInteraction color: StudioTheme.Values.themeControlBackgroundInteraction
MouseArea { MouseArea {
id: topHeaderMouseArea
anchors.fill: parent anchors.fill: parent
anchors.margins: 5 anchors.margins: 5
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
onClicked: (mouse) => { onClicked: (mouse) => {
tableView.model.selectColumn(index) tableView.model.selectColumn(index)
@@ -130,9 +133,17 @@ Rectangle {
} }
} }
HelperWidgets.ToolTipArea { ToolTip {
anchors.fill: parent id: topHeaderToolTip
text: root.model.propertyType(index)
property bool expectedToBeShown: topHeaderMouseArea.containsMouse
visible: expectedToBeShown && text !== ""
delay: 1000
onExpectedToBeShownChanged: {
if (expectedToBeShown)
text = root.model.propertyType(index)
}
} }
} }

View File

@@ -339,8 +339,9 @@ bool CollectionDetailsModel::setPropertyType(int column, const QString &newValue
newValue)); newValue));
if (changed) { if (changed) {
emit headerDataChanged(Qt::Horizontal, column, column); emit headerDataChanged(Qt::Horizontal, column, column);
emit dataChanged(index(0, column), index(rowCount() - 1, column), emit dataChanged(index(0, column),
{Qt::DisplayRole, DataTypeRole, DataTypeWarningRole}); index(rowCount() - 1, column),
{Qt::DisplayRole, DataTypeRole, DataTypeWarningRole, ColumnDataTypeRole});
} }
return changed; return changed;