26 #define YUILogComponent "qt-ui"
27 #include <yui/YUILog.h>
29 #include <qdatetimeedit.h>
30 #include <QVBoxLayout>
34 #include "YQDateField.h"
36 #include "YQWidgetCaption.h"
40 : QFrame( (QWidget *) parent->widgetRep() )
41 , YDateField( parent, label )
43 QVBoxLayout* layout =
new QVBoxLayout(
this );
47 layout->setSpacing( YQWidgetSpacing );
48 layout->setMargin ( YQWidgetMargin );
51 YUI_CHECK_NEW( _caption );
52 layout->addWidget( _caption );
54 _qt_dateEdit =
new QDateEdit(
this );
55 YUI_CHECK_NEW( _qt_dateEdit );
56 layout->addWidget( _qt_dateEdit );
59 _qt_dateEdit->setDisplayFormat(
"yyyy-MM-dd" );
60 _qt_dateEdit->setCalendarPopup(
true);
61 _caption->setBuddy( _qt_dateEdit );
63 connect( _qt_dateEdit, &QDateEdit::dateChanged,
64 this, &YQDateField::changed);
76 return toUTF8( _qt_dateEdit->date().toString( Qt::ISODate ) );
82 _qt_dateEdit->blockSignals(
true);
83 _qt_dateEdit->setDate( QDate::fromString( fromUTF8( newValue ), Qt::ISODate ) );
84 _qt_dateEdit->blockSignals(
false);
90 _caption->
setText( fromUTF8( newLabel ) );
91 YDateField::setLabel( newLabel );
97 QFrame::setEnabled( enabled );
98 YWidget::setEnabled( enabled );
104 return sizeHint().width();
110 return sizeHint().height();
116 resize( newWidth, newHeight );
122 _qt_dateEdit->setFocus();
127 void YQDateField::changed (
const QDate& )
133 #include "YQDateField.moc"