Debugger: modernize ConsoleItem editor connect

Change-Id: Iac2fb696779e02c2fe5296c4f9981c20d21bb3a8
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Tim Jenssen
2016-05-19 12:44:27 +02:00
parent f54dcc4c81
commit cf9d1d5f8e
2 changed files with 5 additions and 12 deletions

View File

@@ -318,8 +318,11 @@ QWidget *ConsoleItemDelegate::createEditor(QWidget *parent,
"background-origin: margin;"
"background-repeat: none;"
"}"));
connect(editor, &ConsoleEdit::editingFinished,
this, &ConsoleItemDelegate::commitAndCloseEditor);
connect(editor, &ConsoleEdit::editingFinished, this, [this, editor] {
auto delegate = const_cast<ConsoleItemDelegate*>(this);
emit delegate->commitData(editor);
emit delegate->closeEditor(editor);
});
return editor;
}
@@ -353,13 +356,6 @@ void ConsoleItemDelegate::currentChanged(const QModelIndex &current,
emit sizeHintChanged(previous);
}
void ConsoleItemDelegate::commitAndCloseEditor()
{
ConsoleEdit *editor = qobject_cast<ConsoleEdit *>(sender());
emit commitData(editor);
emit closeEditor(editor);
}
qreal ConsoleItemDelegate::layoutText(QTextLayout &tl, int width,
bool *showFileLineInfo) const
{