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
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
To copy to clipboard, switch view to plain text mode
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" ) );
dateEdit->setSpecialValueText( " " );
dateEdit->setDate( QDate::fromString( "01/01/0001", "dd/MM/yyyy" ) );
To copy to clipboard, switch view to plain text mode
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
Bookmarks