Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
4.5.2
-
None
-
a767da6f2d0fbee707f5c2fe896fa501b3da6b07
Description
Steps to reproduce:
- Focus the month of the date and remove the numbers
- With numlock disabled enter a new month, say 11 by holding shift and using the numeric keypad
- Notice that after entering 11 the "year"-text isn't selected, as it would be if the numbers had been entered using the numbers above QWERTY or using the numeric keypad with numlock enabled.
The following patch fixes this issue, but likely introduces others as the modifiers check is expectedly there for a reason:
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
index 4d165c0..1c20188 100644
— a/src/gui/widgets/qdatetimeedit.cpp
+++ b/src/gui/widgets/qdatetimeedit.cpp
@@ -1179,7 +1179,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
return; }
}
QAbstractSpinBox::keyPressEvent(event);
- if (select && !(event->modifiers() & Qt::ShiftModifier) && !d->edit->hasSelectedText()) {
+ if (select /&& !(event->modifiers() & Qt::ShiftModifier)/ && !d->edit->hasSelectedText()) {
if (inserted && d->sectionAt(d->edit->cursorPosition()) == QDateTimeParser::NoSectionIndex) {
QString str = d->displayText();
int pos = d->edit->cursorPosition();