Allow to edit PropertyLists directly in the property editor - fixes #2535,#2689

This commit is contained in:
Yorik van Havre
2016-09-05 13:25:32 -03:00
parent d895b3a409
commit da92d338b7
2 changed files with 12 additions and 0 deletions

View File

@@ -1197,6 +1197,8 @@ LabelEditor::LabelEditor (QWidget * parent)
connect(lineEdit, SIGNAL(textChanged(const QString &)),
this, SIGNAL(textChanged(const QString &)));
connect(lineEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(validateText(const QString &)));
button = new QPushButton(QLatin1String("..."), this);
button->setFixedWidth(2*button->fontMetrics().width(QLatin1String(" ... ")));
@@ -1250,6 +1252,15 @@ void LabelEditor::changeText()
}
}
/**
* Validates if the input of the lineedit is a valid list.
*/
void LabelEditor::validateText(const QString& s)
{
if ( s.startsWith(QString::fromUtf8("[")) && s.endsWith(QString::fromUtf8("]")) )
this->plainText = s.mid(1,s.size()-2).replace(QString::fromUtf8(","),QString::fromUtf8("\n"));
}
/**
* Sets the browse button's text to \a txt.
*/

View File

@@ -397,6 +397,7 @@ public:
public Q_SLOTS:
virtual void setText(const QString &);
virtual void setButtonText (const QString &);
virtual void validateText (const QString &);
Q_SIGNALS:
void textChanged(const QString &);