26 #include <qcheckbox.h>
28 #define YUILogComponent "qt-ui"
29 #include <yui/YUILog.h>
32 #include "YQApplication.h"
34 #include <yui/YEvent.h>
35 #include "YQCheckBox.h"
42 const std::string & label,
44 : QCheckBox( fromUTF8( label ), (QWidget *) parent->widgetRep() )
45 , YCheckBox( parent, label )
49 QCheckBox::setChecked( checked );
51 connect(
this, &QCheckBox::stateChanged,
52 this, &YQCheckBox::stateChanged );
65 switch ( checkState() )
67 case Qt::Checked:
return YCheckBox_on;
68 case Qt::Unchecked:
return YCheckBox_off;
69 case Qt::PartiallyChecked:
return YCheckBox_dont_care;
82 QCheckBox::setChecked(
true );
87 QCheckBox::setChecked(
false );
91 case YCheckBox_dont_care:
92 QCheckBox::setTristate(
true );
93 setCheckState(Qt::PartiallyChecked);
101 setText( fromUTF8( label ) );
102 YCheckBox::setLabel( label );
112 YCheckBox::setUseBoldFont( useBold );
118 QCheckBox::setEnabled( enabled );
119 YWidget::setEnabled( enabled );
125 return 2*SPACING + sizeHint().width();
131 return sizeHint().height();
137 resize( newWidth, newHeight );
149 void YQCheckBox::stateChanged(
int newState )
158 #include "YQCheckBox.moc"
YQCheckBox(YWidget *parent, const std::string &label, bool checked)
Constructor.
static YQApplication * yqApp()
Return the global YApplication object as YQApplication.
virtual void setValue(YCheckBoxState state)
Set the CheckBox value (on/off/don't care).
virtual bool setKeyboardFocus()
Accept the keyboard focus.
virtual ~YQCheckBox()
Destructor.
virtual YCheckBoxState value()
Get the current value:
virtual int preferredWidth()
Preferred width of the widget.
virtual void setUseBoldFont(bool bold=true)
Use a bold font.
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
virtual void setLabel(const std::string &label)
Change the label (the text) on the RadioButton.
void sendEvent(YEvent *event)
Widget event handlers (slots) call this when an event occured that should be the answer to a UserInpu...
virtual int preferredHeight()
Preferred height of the widget.
virtual void setEnabled(bool enabled)
Set enabled / disabled state.
static YQUI * ui()
Access the global Qt-UI.