ChrisW67
11th November 2013, 07:11
This code:
#include <QApplication>
#include <QDateTimeEdit>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QDateTimeEdit edit;
edit.setDateTime(QDateTime::currentDateTimeUtc());
edit.setDisplayFormat("yyyy-MM-dd hh:mm");
edit.setSelectedSection(QDateTimeEdit::DaySection) ;
// also tried these:
// edit.setCurrentSection(QDateTimeEdit::DaySection);
// edit.setCurrentSectionIndex(2);
edit.show();
return app.exec();
}
I would have expected to show the current time with the "dd" day field already selected. What I get with 4.8.5/5.1.0 on 64-bit Linux, and 4.8.4 on 32-bit Windows is the year (first, presumably default) section selected. I have also tried deferring the setSelectedSection() call until after the show() with a zero timer. Meanwhile the currentSection() property returns 0x100, i.e. the DaySection.
Am I missing the absolutely obvious?
#include <QApplication>
#include <QDateTimeEdit>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QDateTimeEdit edit;
edit.setDateTime(QDateTime::currentDateTimeUtc());
edit.setDisplayFormat("yyyy-MM-dd hh:mm");
edit.setSelectedSection(QDateTimeEdit::DaySection) ;
// also tried these:
// edit.setCurrentSection(QDateTimeEdit::DaySection);
// edit.setCurrentSectionIndex(2);
edit.show();
return app.exec();
}
I would have expected to show the current time with the "dd" day field already selected. What I get with 4.8.5/5.1.0 on 64-bit Linux, and 4.8.4 on 32-bit Windows is the year (first, presumably default) section selected. I have also tried deferring the setSelectedSection() call until after the show() with a zero timer. Meanwhile the currentSection() property returns 0x100, i.e. the DaySection.
Am I missing the absolutely obvious?