Gui: improve PropertyEditor refresh (#3535)

* Gui: fix PropertyView 'Add property' action

* Gui: fix property view font color for linked property

* Gui: improve PropertyEditor refresh

* Gui: show real property name in property view tool tip

* Gui: improve property view tool tip

* Gui: fix auto recompute in property view

* Gui: remove duplicated PropertyModel signal of dataChanged()

* Gui: fix property view update on property change
Including changes in document properties

* Gui: fix transaction closing on property editor change
On editing row removal and on model reset.

* Gui: fix property view auto expansion of previous selected item

* Gui: improve property editor navigation using tab/shift+tab
This commit is contained in:
Zheng Lei
2022-02-21 19:26:21 +08:00
committed by GitHub
parent 83f0f6c3bb
commit f12ae8a13c
12 changed files with 603 additions and 334 deletions

View File

@@ -76,10 +76,13 @@ void PropertyItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
}
option.palette.setColor(QPalette::Text, color);
option.font.setBold(true);
option.state &= ~QStyle::State_Selected;
}
if (index.column() == 1) {
// Since the group item now parents all the property items and can be
// collapsed, it makes sense to have some selection visual clue for it.
//
// option.state &= ~QStyle::State_Selected;
}
else if (index.column() == 1) {
option.state &= ~QStyle::State_Selected;
}
@@ -131,9 +134,15 @@ QWidget * PropertyItemDelegate::createEditor (QWidget * parent, const QStyleOpti
if (!childItem)
return 0;
PropertyEditor *parentEditor = qobject_cast<PropertyEditor*>(this->parent());
if(parentEditor)
parentEditor->closeEditor();
if (childItem->isSeparator())
return 0;
FC_LOG("create editor " << index.row() << "," << index.column());
PropertyEditor *parentEditor = qobject_cast<PropertyEditor*>(this->parent());
QWidget* editor;
expressionEditor = 0;
if(parentEditor && parentEditor->isBinding())
@@ -153,6 +162,18 @@ QWidget * PropertyItemDelegate::createEditor (QWidget * parent, const QStyleOpti
}
this->pressed = false;
if (editor) {
for (auto w : editor->findChildren<QWidget*>()) {
if (qobject_cast<QAbstractButton*>(w)
|| qobject_cast<QLabel*>(w))
{
w->installEventFilter(const_cast<PropertyItemDelegate*>(this));
}
}
parentEditor->activeEditor = editor;
parentEditor->editingIndex = index;
}
return editor;
}