1 #include "QDS_CheckBox.h"
6 Constructor. This method is protected. Object can't be directly constructed.
7 Use static method QDS_CheckBox::Create instead.
9 QDS_CheckBox::QDS_CheckBox( const QString& id, QWidget* parent, const int flags, const QString& comp )
10 : QDS_Datum( id, parent, flags, comp )
17 QDS_CheckBox::~QDS_CheckBox()
22 Returns string from QCheckBox widget.
24 QString QDS_CheckBox::getString() const
26 return checkBox() && checkBox()->isChecked() ? "1" : "0";
30 Sets the string into QCheckBox widget.
32 void QDS_CheckBox::setString( const QString& txt )
35 int val = (int)txt.toDouble( &isOk );
37 checkBox()->setChecked( isOk && val != 0 );
41 Returns pointer to QCheckBox widget.
43 QCheckBox* QDS_CheckBox::checkBox() const
45 return ::qt_cast<QCheckBox*>( controlWidget() );
49 Create QCheckBox widget as control subwidget.
51 QWidget* QDS_CheckBox::createControl( QWidget* parent )
53 QCheckBox* cb = new QCheckBox( parent );
54 connect( cb, SIGNAL( stateChanged( int ) ), SLOT( onParamChanged() ) );
55 connect( cb, SIGNAL( toggled( bool ) ), SIGNAL( toggled( bool ) ) );
60 Notify about shanging of control state
62 void QDS_CheckBox::onParamChanged()
67 void QDS_CheckBox::setChecked( const bool theState )
70 checkBox()->setChecked( theState );
73 bool QDS_CheckBox::isChecked() const
75 return checkBox() ? checkBox()->isChecked() : false;