Simplify the preamble of QDateTimeEditPrivate::stepBy()
Repetition and needless complexity: eleven lines rewritten in three. Change-Id: I1dadbbc5329b18d3e25f38f73b69abd2d7aac30d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
parent
e0ff15ffd8
commit
03c12974bb
@ -2107,18 +2107,10 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c
|
||||
int pos = edit->cursorPosition();
|
||||
const SectionNode sn = sectionNode(sectionIndex);
|
||||
|
||||
int val;
|
||||
// to make sure it behaves reasonably when typing something and then stepping in non-tracking mode
|
||||
if (!test && pendingEmit) {
|
||||
if (q->validate(str, pos) != QValidator::Acceptable) {
|
||||
v = value.toDateTime();
|
||||
} else {
|
||||
if (!test && pendingEmit && q->validate(str, pos) == QValidator::Acceptable)
|
||||
v = q->dateTimeFromText(str);
|
||||
}
|
||||
val = getDigit(v, sectionIndex);
|
||||
} else {
|
||||
val = getDigit(v, sectionIndex);
|
||||
}
|
||||
int val = getDigit(v, sectionIndex);
|
||||
|
||||
val += steps;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user