21#include "stringlistedit.h"
32class Q_DECL_HIDDEN KPropertyStringListEditor::Private
39 QPushButton *selectButton;
42KPropertyStringListEditor::KPropertyStringListEditor(
KProperty *property,
QWidget *parent)
43 : Widget(property, parent), d(new Private)
51 d->edit->setReadOnly(
true);
53 d->edit->setMinimumHeight(5);
57 Utils::setupDotDotDotButton(d->selectButton, tr(
"Select item"),
58 tr(
"Selects one item"));
62 setFocusWidget(d->selectButton);
64 connect(d->selectButton, SIGNAL(clicked()),
this, SLOT(showEditor()));
67KPropertyStringListEditor::~KPropertyStringListEditor()
73KPropertyStringListEditor::value()
const
79KPropertyStringListEditor::setValue(
const QVariant &value,
bool emitChange)
82 d->edit->setText(value.toStringList().join(
", "));
84 emit valueChanged(
this);
88KPropertyStringListEditor::drawViewer(
QPainter *p,
const QColorGroup &cg,
const QRect &r,
const QVariant &value)
90 Widget::drawViewer(p, cg, r, value.toStringList().join(
", "));
94KPropertyStringListEditor::showEditor()
96 QDialog dialog(this->topLevelWidget());
97 dialog.setWindowTitle(tr(
"Edit List of Items",
"Window title"));
98 dialog.setObjectName(
"stringlist_dialog");
99 dialog.setButtons(QDialog::Ok | QDialog::Cancel);
100 dialog.setDefaultButton(QDialog::Ok);
101 dialog.setModal(
false);
102 KEditListBox *edit =
new KEditListBox(tr(
"Contents of %1").arg(property()->captionOrName()),
103 &dialog,
"editlist");
106 edit->insertStringList(d->list);
109 d->list = edit->items();
110 d->edit->setText(d->list.join(
", "));
111 emit valueChanged(
this);
116KPropertyStringListEditor::setReadOnlyInternal(
bool readOnly)
118 d->selectButton->setEnabled(!readOnly);
The base class representing a single property.
KIOCORE_EXPORT QStringList list(const QString &fileClass)
virtual void setSpacing(int spacing) override
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
QStringList toStringList() const const