diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/itemviews/qtreeview.cpp | 2 | ||||
-rw-r--r-- | src/widgets/util/qundostack.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.cpp | 17 | ||||
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.h | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qdatetimeedit_p.h | 27 |
5 files changed, 24 insertions, 26 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 8031d538a6..cecaa4d8fb 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2556,7 +2556,7 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end) if (((parentItem != -1) && d->viewItems.at(parentItem).expanded) || (parent == d->root)) { d->doDelayedItemsLayout(); - } else if (parentItem != -1 && (d->model->rowCount(parent) == end - start + 1)) { + } else if (parentItem != -1 && parentRowCount == delta) { // the parent just went from 0 children to more. update to re-paint the decoration d->viewItems[parentItem].hasChildren = true; viewport()->update(); diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index 7f6a56e0ec..1a3ff58793 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -930,7 +930,7 @@ QAction *QUndoStack::createRedoAction(QObject *parent, const QString &prefix) co Calls to beginMacro() and endMacro() may be nested, but every call to beginMacro() must have a matching call to endMacro(). - While a macro is composed, the stack is disabled. This means that: + While a macro is being composed, the stack is disabled. This means that: \list \li indexChanged() and cleanChanged() are not emitted, \li canUndo() and canRedo() return false, diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index f72dc088da..cfba2cc87f 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1674,12 +1674,7 @@ QDateTimeEditPrivate::QDateTimeEditPrivate() cachedDay = -1; currentSectionIndex = FirstSectionIndex; - first.type = FirstSection; - last.type = LastSection; - none.type = NoSection; first.pos = 0; - last.pos = -1; - none.pos = -1; sections = 0; calendarPopup = false; minimum = QDATETIMEEDIT_COMPAT_DATETIME_MIN; @@ -2053,7 +2048,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c // doesn't mean that we hit the floor in the other if (steps > 0) { setDigit(v, sectionIndex, min); - if (!(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong)) && sections & DateSectionMask) { + if (!(sn.type & DaySectionMask) && sections & DateSectionMask) { const int daysInMonth = v.date().daysInMonth(); if (v.date().day() < oldDay && v.date().day() < daysInMonth) { const int adds = qMin(oldDay, daysInMonth); @@ -2068,7 +2063,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c } } else { setDigit(v, sectionIndex, max); - if (!(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong)) && sections & DateSectionMask) { + if (!(sn.type & DaySectionMask) && sections & DateSectionMask) { const int daysInMonth = v.date().daysInMonth(); if (v.date().day() < oldDay && v.date().day() < daysInMonth) { const int adds = qMin(oldDay, daysInMonth); @@ -2086,7 +2081,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c setDigit(v, sectionIndex, (steps > 0 ? localmax : localmin)); } } - if (!test && oldDay != v.date().day() && !(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong))) { + if (!test && oldDay != v.date().day() && !(sn.type & DaySectionMask)) { // this should not happen when called from stepEnabled cachedDay = qMax<int>(oldDay, cachedDay); } @@ -2278,15 +2273,15 @@ QDateTimeEdit::Sections QDateTimeEditPrivate::convertSections(QDateTimeParser::S ret |= QDateTimeEdit::SecondSection; if (s & QDateTimeParser::MinuteSection) ret |= QDateTimeEdit::MinuteSection; - if (s & (QDateTimeParser::Hour24Section|QDateTimeParser::Hour12Section)) + if (s & (QDateTimeParser::HourSectionMask)) ret |= QDateTimeEdit::HourSection; if (s & QDateTimeParser::AmPmSection) ret |= QDateTimeEdit::AmPmSection; - if (s & (QDateTimeParser::DaySection|QDateTimeParser::DayOfWeekSectionShort|QDateTimeParser::DayOfWeekSectionLong)) + if (s & (QDateTimeParser::DaySectionMask)) ret |= QDateTimeEdit::DaySection; if (s & QDateTimeParser::MonthSection) ret |= QDateTimeEdit::MonthSection; - if (s & (QDateTimeParser::YearSection|QDateTimeParser::YearSection2Digits)) + if (s & (QDateTimeParser::YearSectionMask)) ret |= QDateTimeEdit::YearSection; return ret; diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index 420ce82f1c..f050061dea 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -75,7 +75,7 @@ class Q_WIDGETS_EXPORT QDateTimeEdit : public QAbstractSpinBox Q_PROPERTY(int sectionCount READ sectionCount) Q_PROPERTY(Qt::TimeSpec timeSpec READ timeSpec WRITE setTimeSpec) public: - enum Section { + enum Section { // a sub-type of QDateTimeParser's like-named enum. NoSection = 0x0000, AmPmSection = 0x0001, MSecSection = 0x0002, diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index e8e0749623..6abb3cd9a3 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -81,14 +81,25 @@ public: void emitSignals(EmitPolicy ep, const QVariant &old); QString textFromValue(const QVariant &f) const; QVariant valueFromText(const QString &f) const; - virtual void _q_editorCursorPositionChanged(int oldpos, int newpos); - virtual void interpret(EmitPolicy ep); - virtual void clearCache() const; QDateTime validateAndInterpret(QString &input, int &, QValidator::State &state, bool fixup = false) const; void clearSection(int index); - virtual QString displayText() const { return edit->text(); } // this is from QDateTimeParser + + // Override QAbstractSpinBoxPrivate: + void _q_editorCursorPositionChanged(int oldpos, int newpos) Q_DECL_OVERRIDE; + void interpret(EmitPolicy ep) Q_DECL_OVERRIDE; + void clearCache() const Q_DECL_OVERRIDE; + QStyle::SubControl newHoverControl(const QPoint &pos) Q_DECL_OVERRIDE; + void updateEditFieldGeometry() Q_DECL_OVERRIDE; + QVariant getZeroVariant() const Q_DECL_OVERRIDE; + void setRange(const QVariant &min, const QVariant &max) Q_DECL_OVERRIDE; + + // Override QDateTimePraser: + QString displayText() const Q_DECL_OVERRIDE { return edit->text(); } + QDateTime getMinimum() const Q_DECL_OVERRIDE { return minimum.toDateTime(); } + QDateTime getMaximum() const Q_DECL_OVERRIDE { return maximum.toDateTime(); } + QLocale locale() const Q_DECL_OVERRIDE { return q_func()->locale(); } int absoluteIndex(QDateTimeEdit::Section s, int index) const; int absoluteIndex(const SectionNode &s) const; @@ -102,18 +113,10 @@ public: void updateCache(const QVariant &val, const QString &str) const; void updateTimeSpec(); - virtual QDateTime getMinimum() const { return minimum.toDateTime(); } - virtual QDateTime getMaximum() const { return maximum.toDateTime(); } - virtual QLocale locale() const { return q_func()->locale(); } QString valueToText(const QVariant &var) const { return textFromValue(var); } QString getAmPmText(AmPm ap, Case cs) const; int cursorPosition() const { return edit ? edit->cursorPosition() : -1; } - virtual QStyle::SubControl newHoverControl(const QPoint &pos); - virtual void updateEditFieldGeometry(); - virtual QVariant getZeroVariant() const; - virtual void setRange(const QVariant &min, const QVariant &max); - void _q_resetButton(); void updateArrow(QStyle::StateFlag state); bool calendarPopupEnabled() const; |