28 #define YUILogComponent "qt-ui"
29 #include <yui/YUILog.h>
33 #include <yui/YEvent.h>
34 #include "YQIntField.h"
35 #include "YQSignalBlocker.h"
36 #include "YQWidgetCaption.h"
37 #include <QVBoxLayout>
48 : QFrame( (QWidget *) parent->widgetRep() )
49 , YIntField( parent, label, minValue, maxValue )
51 QVBoxLayout* layout =
new QVBoxLayout(
this );
56 layout->setSpacing( YQWidgetSpacing );
57 layout->setMargin( YQWidgetMargin );
60 YUI_CHECK_NEW( _caption );
61 layout->addWidget( _caption );
63 _qt_spinBox =
new QSpinBox(
this);
64 _qt_spinBox->setMinimum(minValue);
65 _qt_spinBox->setMaximum(maxValue);
66 _qt_spinBox->setSingleStep(1);
68 YUI_CHECK_NEW( _qt_spinBox );
69 layout->addWidget( _qt_spinBox );
71 _qt_spinBox->setValue( initialValue );
73 _caption->setBuddy( _qt_spinBox );
75 setValue( initialValue );
77 connect( _qt_spinBox,
static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
91 return _qt_spinBox->value();
99 _qt_spinBox->setValue( newValue );
115 YIntField::setLabel( newLabel );
123 _caption->setEnabled ( enabled );
124 _qt_spinBox->setEnabled( enabled );
125 YWidget::setEnabled( enabled );
132 return sizeHint().width();
139 return sizeHint().height();
146 resize( newWidth, newHeight );
153 _qt_spinBox->setFocus();
virtual void setValueInternal(int val)
Set the current value (the number entered by the user or set from the outside) of this IntField.
virtual ~YQIntField()
Destructor.
virtual void setLabel(const std::string &label)
Set the label (the caption above the input field).
virtual int preferredHeight()
Preferred height of the widget.
void valueChanged(int newValue)
Emitted when the value changes (regardless of the notify flag).
virtual void setEnabled(bool enabled)
Sets the widget's enabled state.
virtual int preferredWidth()
Preferred width of the widget.
virtual int value()
Get the current value (the number entered by the user or set from the outside) of this IntField.
YQIntField(YWidget *parent, const std::string &label, int minValue, int maxValue, int initialValue)
Constructor.
void valueChangedSlot(int newValue)
Slot for "value changed".
virtual bool setKeyboardFocus()
Accept the keyboard focus.
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
Helper class to block Qt signals for QWidgets or QObjects as long as this object exists.
static YQUI * ui()
Access the global Qt-UI.
void sendEvent(YEvent *event)
Widget event handlers (slots) call this when an event occured that should be the answer to a UserInpu...