Henry Blue Heeler
25th September 2014, 02:36
QDateEdit clear() clears only the currentSection
dateEdit->setSelectedSection(QDateEdit::DaySection);
dateEdit->clear(); // this clears the Day
dateEdit->setSelectedSection(QDateEdit::MonthSection);
dateEdit->clear(); // this does not clear the Month because the blank Day is invalid
Workarounds like the following clear the dateEdit field, but then a date like 09/24/2014 cannot be entered.
Only the calendar popup works to set the date in the dateEdit field.
dateEdit->setSpecialValueText( " " );
dateEdit->setDate( QDate::fromString( "01/01/0001", "dd/MM/yyyy" ) );
I've reviewed many suggestions, here and elsewhere and none work.
The next course of action is to derive QLineEdit, unless somebody else has a better idea.
QT 5.1.1 Win 7 x64
dateEdit->setSelectedSection(QDateEdit::DaySection);
dateEdit->clear(); // this clears the Day
dateEdit->setSelectedSection(QDateEdit::MonthSection);
dateEdit->clear(); // this does not clear the Month because the blank Day is invalid
Workarounds like the following clear the dateEdit field, but then a date like 09/24/2014 cannot be entered.
Only the calendar popup works to set the date in the dateEdit field.
dateEdit->setSpecialValueText( " " );
dateEdit->setDate( QDate::fromString( "01/01/0001", "dd/MM/yyyy" ) );
I've reviewed many suggestions, here and elsewhere and none work.
The next course of action is to derive QLineEdit, unless somebody else has a better idea.
QT 5.1.1 Win 7 x64