21 #include "symbolcombo.h" 24 #include <QPushButton> 27 #include <QHBoxLayout> 29 class Q_DECL_HIDDEN KPropertySymbolComboEditor::Private
38 KPropertySymbolComboEditor::KPropertySymbolComboEditor(
KProperty *property,
QWidget *parent)
39 :
Widget(property, parent), d(new Private)
45 d->edit->setReadOnly(
true);
47 d->edit->setMinimumHeight(5);
48 d->edit->setMaxLength(1);
51 Utils::setupDotDotDotButton(d->select, tr(
"Select symbol"),
52 tr(
"Selects a symbol"));
54 d->select->setMinimumHeight(5);
57 connect(d->select, SIGNAL(clicked()),
this, SLOT(selectChar()));
58 connect(d->edit, SIGNAL(textChanged(
const QString&)),
this, SLOT(slotValueChanged(
const QString&)));
61 KPropertySymbolComboEditor::~KPropertySymbolComboEditor()
67 KPropertySymbolComboEditor::value()
const 69 if (!(d->edit->text().isNull()))
70 return d->edit->text().at(0).unicode();
76 KPropertySymbolComboEditor::setValue(
const QVariant &value,
bool emitChange)
80 d->edit->blockSignals(
true);
82 d->edit->blockSignals(
false);
84 emit valueChanged(
this);
89 KPropertySymbolComboEditor::drawViewer(
QPainter *p,
const QColorGroup &cg,
const QRect &r,
const QVariant &value)
95 KPropertySymbolComboEditor::selectChar()
97 QDialog dialog(this->topLevelWidget());
98 dialog.setWindowTitle(tr(
"Select Character",
"Window title"));
99 dialog.setObjectName(
"charselect_dialog");
100 dialog.setButtons(QDialog::Ok | QDialog::Cancel);
101 dialog.setDefaultButton(QDialog::Ok);
102 dialog.setModal(
false);
105 dialog.setObjectName(
"select_char");
109 if (!(d->edit->text().isNull()))
117 KPropertySymbolComboEditor::slotValueChanged(
const QString&)
119 emit valueChanged(
this);
123 KPropertySymbolComboEditor::setReadOnlyInternal(
bool readOnly)
125 d->select->setEnabled(!readOnly);
QChar currentChar() const
int toInt(bool *ok) const const
bool isNull() const const
void setCurrentChar(const QChar &c)
The base class representing a single property.