forked from qt-creator/qt-creator
Debugger: modernize ConsoleItem editor connect
Change-Id: Iac2fb696779e02c2fe5296c4f9981c20d21bb3a8 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -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 ¤t,
|
||||
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
|
||||
{
|
||||
|
||||
@@ -61,9 +61,6 @@ protected:
|
||||
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
|
||||
private slots:
|
||||
void commitAndCloseEditor();
|
||||
|
||||
private:
|
||||
qreal layoutText(QTextLayout &tl, int width, bool *success = 0) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user