PropertyEditor: improve editing experience

This commit is contained in:
Zheng, Lei
2018-09-11 13:01:32 +08:00
committed by wmayer
parent 762b24352b
commit 652e9314bd
4 changed files with 31 additions and 3 deletions

View File

@@ -53,6 +53,9 @@ PropertyEditor::PropertyEditor(QWidget *parent)
QStyleOptionViewItem opt = viewOptions();
this->background = opt.palette.dark();
this->groupColor = opt.palette.color(QPalette::BrightText);
connect(this, SIGNAL(activated(const QModelIndex &)), this, SLOT(onItemActivated(const QModelIndex &)));
connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(onItemActivated(const QModelIndex &)));
}
PropertyEditor::~PropertyEditor()
@@ -127,8 +130,17 @@ void PropertyEditor::currentChanged ( const QModelIndex & current, const QModelI
QTreeView::currentChanged(current, previous);
if (previous.isValid())
closePersistentEditor(model()->buddy(previous));
if (current.isValid())
openPersistentEditor(model()->buddy(current));
// DO NOT activate editor here, use onItemActivate() which response to
// signals of activated and clicked.
//
// if (current.isValid())
// openPersistentEditor(model()->buddy(current));
}
void PropertyEditor::onItemActivated ( const QModelIndex & index )
{
openPersistentEditor(model()->buddy(index));
}
void PropertyEditor::reset()