21#include <tqlineedit.h>
22#include <tqpushbutton.h>
27#include <kcharselect.h>
29#include <kdialogbase.h>
31#include "symbolcombo.h"
35SymbolCombo::SymbolCombo(
Property *property, TQWidget *parent,
const char *name)
39 TQHBoxLayout *l =
new TQHBoxLayout(
this);
41 m_edit =
new TQLineEdit(
this);
42 m_edit->setLineWidth(0);
43 m_edit->setReadOnly(
true);
44 m_edit->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding);
45 m_edit->setMinimumHeight(5);
46 m_edit->setMaxLength(1);
48 m_select =
new TQPushButton(
"...",
this);
49 m_select->setSizePolicy(TQSizePolicy::Maximum, TQSizePolicy::MinimumExpanding);
50 m_select->setMinimumHeight(5);
51 l->addWidget(m_select);
53 connect(m_select, TQ_SIGNAL(clicked()),
this, TQ_SLOT(selectChar()));
54 connect(m_edit, TQ_SIGNAL(textChanged(
const TQString&)),
this, TQ_SLOT(slotValueChanged(
const TQString&)));
57SymbolCombo::~SymbolCombo()
63 if (!(m_edit->text().isNull()))
64 return m_edit->text().at(0).unicode();
70SymbolCombo::setValue(
const TQVariant &value,
bool emitChange)
72 if (!(value.isNull()))
74 m_edit->blockSignals(
true);
75 m_edit->setText(TQChar(value.toInt()));
76 m_edit->blockSignals(
false);
78 emit valueChanged(
this);
83SymbolCombo::drawViewer(TQPainter *p,
const TQColorGroup &cg,
const TQRect &r,
const TQVariant &value)
91SymbolCombo::selectChar()
93 KDialogBase dialog(this->topLevelWidget(),
"charselect_dialog",
true, i18n(
"Select Char"),
96 KCharSelect *select =
new KCharSelect(&dialog,
"select_char");
97 dialog.setMainWidget(select);
99 if (!(m_edit->text().isNull()))
100 select->
setChar(m_edit->text().at(0));
102 if (dialog.exec() == TQDialog::Accepted)
103 m_edit->setText(select->
chr());
107SymbolCombo::slotValueChanged(
const TQString&)
109 emit valueChanged(
this);
113SymbolCombo::setReadOnlyInternal(
bool readOnly)
115 m_select->setEnabled(!readOnly);
118#include "symbolcombo.moc"
virtual TQChar chr() const
virtual void setChar(const TQChar &chr)
The base class representing a single property.
const char * name(StdAction id)
Namespace for a set of classes implementing generic properties framework.