26 #define YUILogComponent "qt-ui"
27 #include <yui/YUILog.h>
29 #include <qdatetimeedit.h>
30 #include <QVBoxLayout>
34 #include "YQDateField.h"
35 #include "yui/YEvent.h"
36 #include "YQWidgetCaption.h"
42 : QFrame( (QWidget *) parent->widgetRep() )
43 , YDateField( parent, label )
45 QVBoxLayout* layout =
new QVBoxLayout(
this );
49 layout->setSpacing( YQWidgetSpacing );
50 layout->setMargin ( YQWidgetMargin );
53 YUI_CHECK_NEW( _caption );
54 layout->addWidget( _caption );
56 _qt_dateEdit =
new QDateEdit(
this );
57 YUI_CHECK_NEW( _qt_dateEdit );
58 layout->addWidget( _qt_dateEdit );
61 _qt_dateEdit->setDisplayFormat(
"yyyy-MM-dd" );
62 _qt_dateEdit->setCalendarPopup(
true);
63 _caption->setBuddy( _qt_dateEdit );
65 connect( _qt_dateEdit, &QDateEdit::dateChanged,
66 this, &YQDateField::changed);
78 return toUTF8( _qt_dateEdit->date().toString( Qt::ISODate ) );
84 _qt_dateEdit->blockSignals(
true);
85 _qt_dateEdit->setDate( QDate::fromString( fromUTF8( newValue ), Qt::ISODate ) );
86 _qt_dateEdit->blockSignals(
false);
92 _caption->
setText( fromUTF8( newLabel ) );
93 YDateField::setLabel( newLabel );
99 QFrame::setEnabled( enabled );
100 YWidget::setEnabled( enabled );
106 return sizeHint().width();
112 return sizeHint().height();
118 resize( newWidth, newHeight );
124 _qt_dateEdit->setFocus();
129 void YQDateField::changed (
const QDate& )