Allow to edit PropertyLists directly in the property editor - fixes #2535,#2689
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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 &);
|
||||
|
||||
Reference in New Issue
Block a user