26 #define YUILogComponent "qt-ui" 27 #include <yui/YUILog.h> 29 #include <qdatetimeedit.h> 33 #include "YQTimeField.h" 35 #include "YQWidgetCaption.h" 36 #include <QVBoxLayout> 40 : QFrame( (QWidget *) parent->widgetRep() )
41 , YTimeField( parent, label )
44 QVBoxLayout* layout =
new QVBoxLayout(
this );
47 layout->setSpacing( YQWidgetSpacing );
48 layout->setMargin ( YQWidgetMargin );
51 YUI_CHECK_NEW( _caption );
52 layout->addWidget( _caption );
54 _qt_timeEdit =
new QTimeEdit(
this );
55 YUI_CHECK_NEW( _qt_timeEdit );
56 _qt_timeEdit->setDisplayFormat(
"hh:mm:ss");
57 layout->addWidget( _qt_timeEdit );
59 _caption->setBuddy( _qt_timeEdit );
61 connect( _qt_timeEdit, &QTimeEdit::timeChanged,
62 this, &YQTimeField::changed);
74 return toUTF8( _qt_timeEdit->time().toString( Qt::ISODate ) );
80 _qt_timeEdit->blockSignals(
true);
81 _qt_timeEdit->setTime( QTime::fromString( fromUTF8( newValue ), Qt::ISODate ) );
82 _qt_timeEdit->blockSignals(
false);
88 _caption->
setText( fromUTF8( newLabel ) );
89 YTimeField::setLabel( newLabel );
95 QFrame::setEnabled( enabled );
96 YWidget::setEnabled( enabled );
102 return sizeHint().width();
108 return sizeHint().height();
114 resize( newWidth, newHeight );
120 _qt_timeEdit->setFocus();
125 void YQTimeField::changed (
const QTime& )
132 #include "YQTimeField.moc" virtual void setValue(const std::string &newValue)
Set the current value (the text entered by the user or set from the outside) of this input field...
virtual bool setKeyboardFocus()
Accept the keyboard focus.
YQTimeField(YWidget *parent, const std::string &label)
Constructor.
virtual ~YQTimeField()
Destructor.
virtual int preferredHeight()
Preferred height of the widget.
void sendEvent(YEvent *event)
Widget event handlers (slots) call this when an event occured that should be the answer to a UserInpu...
virtual int preferredWidth()
Preferred width of the widget.
virtual std::string value()
Get the current value (the text entered by the user or set from the outside) of this input field...
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
virtual void setLabel(const std::string &label)
Set the label (the caption above the input field).
virtual void setEnabled(bool enabled)
Set enabled/disabled state.
static YQUI * ui()
Access the global Qt-UI.