forked from qt-creator/qt-creator
Utils: Fix connection error
When add / remove buttons are disabled, the connection fails. Change-Id: I6c9a3233f156b88e516481a6fc8e072ea5e1c13b Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2681,22 +2681,26 @@ void StringListAspect::addToLayout(Layout &parent)
|
||||
}
|
||||
};
|
||||
|
||||
connect(add, &QPushButton::clicked, this, [this, populate, editor] {
|
||||
d->undoable.setSilently(d->undoable.get() << "");
|
||||
populate();
|
||||
const QTreeWidgetItem *root = editor->invisibleRootItem();
|
||||
QTreeWidgetItem *lastChild = root->child(root->childCount() - 1);
|
||||
const QModelIndex index = editor->indexFromItem(lastChild, 0);
|
||||
editor->edit(index);
|
||||
});
|
||||
if (add) {
|
||||
connect(add, &QPushButton::clicked, this, [this, populate, editor] {
|
||||
d->undoable.setSilently(d->undoable.get() << "");
|
||||
populate();
|
||||
const QTreeWidgetItem *root = editor->invisibleRootItem();
|
||||
QTreeWidgetItem *lastChild = root->child(root->childCount() - 1);
|
||||
const QModelIndex index = editor->indexFromItem(lastChild, 0);
|
||||
editor->edit(index);
|
||||
});
|
||||
}
|
||||
|
||||
connect(remove, &QPushButton::clicked, this, [this, editor, itemsToStringList] {
|
||||
const QList<QTreeWidgetItem *> selected = editor->selectedItems();
|
||||
QTC_ASSERT(selected.size() == 1, return);
|
||||
editor->invisibleRootItem()->removeChild(selected.first());
|
||||
delete selected.first();
|
||||
d->undoable.set(undoStack(), itemsToStringList());
|
||||
});
|
||||
if (remove) {
|
||||
connect(remove, &QPushButton::clicked, this, [this, editor, itemsToStringList] {
|
||||
const QList<QTreeWidgetItem *> selected = editor->selectedItems();
|
||||
QTC_ASSERT(selected.size() == 1, return);
|
||||
editor->invisibleRootItem()->removeChild(selected.first());
|
||||
delete selected.first();
|
||||
d->undoable.set(undoStack(), itemsToStringList());
|
||||
});
|
||||
}
|
||||
|
||||
connect(
|
||||
&d->undoable.m_signal, &UndoSignaller::changed, editor, [this, populate, itemsToStringList] {
|
||||
|
Reference in New Issue
Block a user