QmlJS: Clean up QML console editor

Align the text between editing and display mode, and remove the dead
code. The prompt sign does not have to be part of the text and the
JS parser does not have to retain the code it parses.

Change-Id: I6e41f4fbc2cc863c84677640826d8663bcc648fb
Task-number: QTCREATORBUG-14931
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-10-28 19:24:16 +01:00
parent 19ab78865c
commit 5babad8c38
5 changed files with 21 additions and 122 deletions

View File

@@ -312,6 +312,18 @@ QWidget *QmlConsoleItemDelegate::createEditor(QWidget *parent,
{
QmlConsoleEdit *editor = new QmlConsoleEdit(index, parent);
// Fiddle the prompt into the margin so that we don't have to put it into the text.
// Apparently you can have both background-image and background-color, which conveniently
// prevents the painted text from shining through.
editor->setStyleSheet(QLatin1String("QTextEdit {"
"margin-left: 24px;"
"margin-top: 4px;"
"background-color: white;"
"background-image: url(:/qmljstools/images/prompt.png);"
"background-position: baseline left;"
"background-origin: margin;"
"background-repeat: none;"
"}"));
connect(editor, &QmlConsoleEdit::editingFinished,
this, &QmlConsoleItemDelegate::commitAndCloseEditor);
return editor;