20#include "pyesnobutton.h"
24#include <tqpushbutton.h>
29#include "compat_tools.h"
34PYesNoButton::PYesNoButton(MultiProperty* property, TQWidget* parent,
const char* name)
35 :PropertyWidget(property, parent, name)
37 TQHBoxLayout *l =
new TQHBoxLayout(
this, 0, 0);
38 m_edit =
new TQPushButton(
this);
39 m_edit->setToggleButton(
true);
40 m_edit->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding);
43 connect(m_edit, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(updateProperty(
bool)));
46TQVariant PYesNoButton::value()
const
48 return TQVariant(m_edit->isOn());
51void PYesNoButton::drawViewer(TQPainter* p,
const TQColorGroup& cg,
const TQRect& r,
const TQVariant& value)
53 PropertyWidget::drawViewer(p, cg, r, value.toBool() ? i18n(
"Yes") : i18n(
"No"));
56void PYesNoButton::setValue(
const TQVariant& value,
bool emitChange)
58 disconnect(m_edit, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(updateProperty(
bool)));
59 m_edit->setDown(value.toBool());
60 value.toBool() ? m_edit->setText(i18n(
"Yes")) : m_edit->setText(i18n(
"No"));
61 connect(m_edit, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(updateProperty(
bool)));
63 emit propertyChanged(m_property, value);
66void PYesNoButton::updateProperty(
bool toggled)
68 toggled ? m_edit->setText(i18n(
"Yes")) : m_edit->setText(i18n(
"No"));
69 emit propertyChanged(m_property, value());
75#include "pyesnobutton.moc"
Namespace which contain property editing classes.