20 #include "pcheckbox.h" 23 #include <tqcheckbox.h> 24 #include <tqpainter.h> 27 #include <tdelocale.h> 29 #include "compat_tools.h" 34 PCheckBox::PCheckBox(MultiProperty *property, TQWidget *parent,
const char *name)
35 :PropertyWidget(property, parent, name)
37 TQHBoxLayout *l =
new TQHBoxLayout(
this, 0, 0);
38 m_edit =
new TQCheckBox(
this);
39 m_edit->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding);
42 connect(m_edit, TQT_SIGNAL(toggled(
bool)),
this, TQT_SLOT(updateProperty(
bool)));
47 return TQVariant(m_edit->isChecked());
52 disconnect(m_edit, TQT_SIGNAL(toggled(
bool)),
this, TQT_SLOT(updateProperty(
bool)));
53 m_edit->setChecked(value.toBool());
54 connect(m_edit, TQT_SIGNAL(toggled(
bool)),
this, TQT_SLOT(updateProperty(
bool)));
56 emit propertyChanged(m_property, value);
59 void PCheckBox::updateProperty(
bool val)
61 emit propertyChanged(m_property, TQVariant(val));
66 p->setBrush(cg.background());
67 p->setPen(TQt::NoPen);
69 p->drawText(r, TQt::AlignLeft | TQt::AlignVCenter | TQt::SingleLine, value.toBool() ? i18n(
"true") : i18n(
"false"));
75 #include "pcheckbox.moc" virtual TQVariant value() const
virtual void setValue(const TQVariant &value, bool emitChange=true)
Sets the value shown in the editor widget.
Namespace which contain property editing classes.
TQVariant value() const
Returns the value of a property.
virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value)
Function to draw a property viewer when the editor isn't shown.