Gui: Enable single click expand property editor

This commit is contained in:
Pieter Hijma
2025-09-15 15:07:32 +02:00
parent 8e1f983e37
commit ade4e4d96a

View File

@@ -76,7 +76,7 @@ PropertyEditor::PropertyEditor(QWidget* parent)
setAlternatingRowColors(true);
setRootIsDecorated(false);
setExpandsOnDoubleClick(true);
setExpandsOnDoubleClick(false);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QStyleOptionViewItem opt = PropertyEditor::viewOptions();
@@ -411,6 +411,18 @@ void PropertyEditor::openEditor(const QModelIndex& index)
void PropertyEditor::onItemActivated(const QModelIndex& index)
{
if (!index.isValid()) {
return;
}
if (auto* prop = static_cast<PropertyItem*>(index.internalPointer());
prop && prop->isSeparator()) {
// setExpanded() only works on column 0
QModelIndex idxFirstColum = propertyModel->index(index.row(), 0, index.parent());
setExpanded(idxFirstColum, !isExpanded(idxFirstColum));
return;
}
if (index.column() != 1) {
return;
}