23#include <tqcheckbox.h>
29#include "compat_tools.h"
34PCheckBox::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, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(updateProperty(
bool)));
45TQVariant PCheckBox::value()
const
47 return TQVariant(m_edit->isChecked());
50void PCheckBox::setValue(
const TQVariant &value,
bool emitChange)
52 disconnect(m_edit, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(updateProperty(
bool)));
53 m_edit->setChecked(value.toBool());
54 connect(m_edit, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(updateProperty(
bool)));
56 emit propertyChanged(m_property, value);
59void PCheckBox::updateProperty(
bool val)
61 emit propertyChanged(m_property, TQVariant(val));
64void PCheckBox::drawViewer(TQPainter *p,
const TQColorGroup &cg,
const TQRect &r,
const TQVariant &value)
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"
Namespace which contain property editing classes.