Gui: fix missing property editor transaction closing
The problem happens when refreshing property editor while editing.
This commit is contained in:
@@ -159,16 +159,7 @@ void PropertyEditor::editorDestroyed (QObject * editor)
|
||||
// When editing expression through context menu, the editor (ExpLineEditor)
|
||||
// deletes itself when finished, so it won't trigger closeEditor signal. We
|
||||
// must handle it here to perform auto update.
|
||||
if (autoupdate) {
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (doc) {
|
||||
if (!doc->isTransactionEmpty()) {
|
||||
if (doc->isTouched())
|
||||
doc->recompute();
|
||||
}
|
||||
}
|
||||
App::GetApplication().closeActiveTransaction();
|
||||
}
|
||||
closeTransaction();
|
||||
}
|
||||
|
||||
void PropertyEditor::currentChanged ( const QModelIndex & current, const QModelIndex & previous )
|
||||
@@ -246,10 +237,8 @@ void PropertyEditor::onItemActivated ( const QModelIndex & index )
|
||||
setupTransaction(index);
|
||||
}
|
||||
|
||||
void PropertyEditor::closeEditor (QWidget * editor, QAbstractItemDelegate::EndEditHint hint)
|
||||
void PropertyEditor::closeTransaction()
|
||||
{
|
||||
QTreeView::closeEditor(editor, hint);
|
||||
|
||||
if (autoupdate) {
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (doc) {
|
||||
@@ -262,6 +251,13 @@ void PropertyEditor::closeEditor (QWidget * editor, QAbstractItemDelegate::EndEd
|
||||
}
|
||||
App::GetApplication().closeActiveTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyEditor::closeEditor (QWidget * editor, QAbstractItemDelegate::EndEditHint hint)
|
||||
{
|
||||
QTreeView::closeEditor(editor, hint);
|
||||
|
||||
closeTransaction();
|
||||
|
||||
QModelIndex indexSaved = currentIndex();
|
||||
FC_LOG("index saved " << indexSaved.row() << ", " << indexSaved.column());
|
||||
@@ -329,6 +325,9 @@ void PropertyEditor::buildUp(PropertyModel::PropertyList &&props, bool checkDocu
|
||||
return;
|
||||
}
|
||||
|
||||
if(this->state() == EditingState)
|
||||
closeTransaction();
|
||||
|
||||
QModelIndex index = this->currentIndex();
|
||||
QStringList propertyPath = propertyModel->propertyPathFromIndex(index);
|
||||
if (!propertyPath.isEmpty())
|
||||
|
||||
@@ -107,6 +107,7 @@ private:
|
||||
void setEditorMode(const QModelIndex & parent, int start, int end);
|
||||
void updateItemEditor(bool enable, int column, const QModelIndex& parent);
|
||||
void setupTransaction(const QModelIndex &);
|
||||
void closeTransaction();
|
||||
|
||||
private:
|
||||
PropertyItemDelegate *delegate;
|
||||
|
||||
Reference in New Issue
Block a user