summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-04-13 06:55:37 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2016-04-13 06:55:37 +0200
commitb94773c9c838a0b3db1bced0bc8daf5b04aefc29 (patch)
tree4afe809fa3ac8a83f5eaf98d0b40d4bbf7b5fca4 /src/widgets
parentc327fb79e1a50c825a945e97f2c66d07a1c6d225 (diff)
parent541c9d4d2acd045459c3e75eee80c63b36af9ed0 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: config.tests/unix/compile.test src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/testlib/qtestcase.cpp src/testlib/qtestcase.qdoc Change-Id: Ied3c471dbc9a076c8de33d673bd557e88575609d
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/util/qundostack.cpp2
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp17
-rw-r--r--src/widgets/widgets/qdatetimeedit.h2
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h27
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;