summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-31 20:09:14 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-01 06:02:55 +0100
commita732576a66ff2bbd9c0b41cd5f3505a4d2fbf043 (patch)
treed09875c3543ad837fbfaaf10bd4eef1d3de42941 /src/widgets
parentcd9de59177ccbeb7fdfacf8716af7bb20112c880 (diff)
parent8e20daae9fee5f3b999daffce0d7156015ee974b (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: config.tests/win/msvc_version.cpp configure.pri mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf src/corelib/io/qsettings_mac.cpp src/corelib/json/qjsondocument.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.h src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro src/plugins/platforms/ios/qiosintegration.h src/plugins/platforms/minimalegl/qminimaleglintegration.cpp tests/auto/gui/painting/qpainter/tst_qpainter.cpp tools/configure/environment.cpp Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp5
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp9
-rw-r--r--src/widgets/kernel/qwidget.cpp4
-rw-r--r--src/widgets/kernel/qwidget_p.h3
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp10
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp10
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm8
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp36
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h4
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp4
-rw-r--r--src/widgets/widgets/qcombobox.cpp11
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp4
-rw-r--r--src/widgets/widgets/qmainwindow.cpp6
-rw-r--r--src/widgets/widgets/qtabbar.cpp7
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp7
18 files changed, 87 insertions, 47 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 879f085f11..74875faf21 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -892,6 +892,9 @@ void QFileDialogPrivate::_q_goToUrl(const QUrl &url)
{QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last()},
a native image picker dialog will be used for accessing the user's photo album.
The filename returned can be loaded using QFile and related APIs.
+ For this to be enabled, the Info.plist assigned to QMAKE_INFO_PLIST in the
+ project file must contain the key \c NSPhotoLibraryUsageDescription. See
+ Info.plist documentation from Apple for more information regarding this key.
This feature was added in Qt 5.5.
*/
void QFileDialog::setDirectory(const QString &directory)
@@ -2034,10 +2037,12 @@ QString QFileDialog::labelText(DialogLabel label) const
button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Save);
if (button)
return button->text();
+ break;
case Reject:
button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel);
if (button)
return button->text();
+ break;
}
return QString();
}
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index bab8436dce..e4115c9e60 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -366,7 +366,7 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option,
if it is enabled or selected.
After painting, you should ensure that the painter is returned to
- its the state it was supplied in when this function was called.
+ the state it was supplied in when this function was called.
For example, it may be useful to call QPainter::save() before
painting and QPainter::restore() afterwards.
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index b94aa826d3..89eff898fe 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -4160,13 +4160,10 @@ void QApplication::beep()
\relates QApplication
A global pointer referring to the unique application object. It is
- equivalent to the pointer returned by the QCoreApplication::instance()
- function except that, in GUI applications, it is a pointer to a
- QApplication instance.
+ equivalent to QCoreApplication::instance(), but cast as a QApplication pointer,
+ so only valid when the unique application object is a QApplication.
- Only one application object can be created.
-
- \sa QCoreApplication::instance()
+ \sa QCoreApplication::instance(), qGuiApp
*/
/*!
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index c7026781b5..dc04bfb632 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -809,6 +809,10 @@ void QWidget::setAutoFillBackground(bool enabled)
parentWidget(), window(), setParent(), winId(),
find(), metric().
+ \row \li Context menu \li
+ contextMenuPolicy, contextMenuEvent(),
+ customContextMenuRequested(), actions()
+
\row \li Interactive help \li
setToolTip(), setWhatsThis()
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 2720c0dc31..68e063c25a 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -402,9 +402,6 @@ public:
const QRegion &rgn, const QPoint &offset, int flags,
QPainter *sharedPainter, QWidgetBackingStore *backingStore);
-
- QPainter *beginSharedPainter();
- bool endSharedPainter();
#ifndef QT_NO_GRAPHICSVIEW
static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin);
#endif
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index a10c88308c..910704498c 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -112,6 +112,7 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
if (widget != tlw)
offset += widget->mapTo(tlw, QPoint());
+ QRegion effectiveRegion = region;
#ifndef QT_NO_OPENGL
const bool compositionWasActive = widget->d_func()->renderToTextureComposeActive;
if (!widgetTextures) {
@@ -125,6 +126,11 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
} else {
widget->d_func()->renderToTextureComposeActive = true;
}
+ // When changing the composition status, make sure the dirty region covers
+ // the entire widget. Just having e.g. the shown/hidden render-to-texture
+ // widget's area marked as dirty is incorrect when changing flush paths.
+ if (compositionWasActive != widget->d_func()->renderToTextureComposeActive)
+ effectiveRegion = widget->rect();
// re-test since we may have been forced to this path via the dummy texture list above
if (widgetTextures) {
@@ -136,12 +142,12 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
const bool translucentBackground = widget->testAttribute(Qt::WA_TranslucentBackground);
// Use the tlw's context, not widget's. The difference is important with native child
// widgets where tlw != widget.
- backingStore->handle()->composeAndFlush(widget->windowHandle(), region, offset, widgetTextures,
+ backingStore->handle()->composeAndFlush(widget->windowHandle(), effectiveRegion, offset, widgetTextures,
tlw->d_func()->shareContext(), translucentBackground);
widget->window()->d_func()->sendComposeStatus(widget->window(), true);
} else
#endif
- backingStore->flush(region, widget->windowHandle(), offset);
+ backingStore->flush(effectiveRegion, widget->windowHandle(), offset);
}
#ifndef QT_NO_PAINT_DEBUG
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index f3fbe13763..3e15b6977a 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -535,7 +535,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// activate window of the widget under mouse pointer
if (!w->isActiveWindow()) {
w->activateWindow();
- w->raise();
+ w->window()->raise();
}
QWindow *win = w->windowHandle();
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 140f0ad2f3..690c811140 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -5246,6 +5246,8 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
return result;
}
+static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); }
+
#ifndef QT_NO_IMAGEFORMAT_PNG
static inline QString clearText16IconPath()
{
@@ -5590,7 +5592,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
#ifndef QT_NO_IMAGEFORMAT_XPM
switch (sp) {
case SP_TitleBarMenuButton:
- return cachedPixmapFromXPM(qt_menu_xpm);
+ return titleBarMenuCachedPixmapFromXPM();
case SP_TitleBarShadeButton:
return cachedPixmapFromXPM(qt_shade_xpm);
case SP_TitleBarUnshadeButton:
@@ -6130,6 +6132,12 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
case SP_MediaVolumeMuted:
icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"), QSize(16, 16));
break;
+ case SP_TitleBarMenuButton:
+# ifndef QT_NO_IMAGEFORMAT_XPM
+ icon.addPixmap(titleBarMenuCachedPixmapFromXPM());
+# endif
+ icon.addFile(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));
+ break;
#endif // QT_NO_IMAGEFORMAT_PNG
default:
icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget));
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 06c3101643..3473ec7fb0 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1080,8 +1080,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
painter->setPen(innerLine);
painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1);
painter->restore();
- return;
}
+ break;
case CE_SizeGrip:
painter->save();
{
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 1f17810fc9..007ce20175 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -949,6 +949,8 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
#if defined(QMAC_QAQUASTYLE_SIZE_CONSTRAIN) || defined(DEBUG_SIZE_CONSTRAINT)
static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSize small, QSize mini)
{
+ Q_UNUSED(widg);
+
if (large == QSize(-1, -1)) {
if (small != QSize(-1, -1))
return QAquaSizeSmall;
@@ -964,7 +966,7 @@ static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSiz
}
#ifndef QT_NO_MAINWINDOW
- if (qobject_cast<QDockWidget *>(widg->window()) || qEnvironmentVariableIsSet("QWIDGET_ALL_SMALL")) {
+ if (qEnvironmentVariableIsSet("QWIDGET_ALL_SMALL")) {
//if (small.width() != -1 || small.height() != -1)
return QAquaSizeSmall;
} else if (qEnvironmentVariableIsSet("QWIDGET_ALL_MINI")) {
@@ -4212,10 +4214,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
bool selected = (myTab.state & QStyle::State_Selected);
- if (selected && !myTab.documentMode
- && (!usingYosemiteOrLater || myTab.state & State_Active))
- myTab.palette.setColor(QPalette::WindowText, Qt::white);
-
// Check to see if we use have the same as the system font
// (QComboMenuItem is internal and should never be seen by the
// outside world, unless they read the source, in which case, it's
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 9d764d2a41..4ce359a7c4 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -699,7 +699,7 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
bool translucentToplevel = false;
const QPaintDevice *paintDevice = painter->device();
- const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatio() : 1;
+ const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatioF() : qreal(1);
if (paintDevice->devType() == QInternal::Widget) {
const QWidget *window = static_cast<const QWidget *>(paintDevice)->window();
translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground);
@@ -727,28 +727,28 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0);
const bool result = dc
- ? drawBackgroundDirectly(dc, themeData, qRound(aditionalDevicePixelRatio))
- : drawBackgroundThruNativeBuffer(themeData, qRound(aditionalDevicePixelRatio));
+ ? drawBackgroundDirectly(dc, themeData, aditionalDevicePixelRatio)
+ : drawBackgroundThruNativeBuffer(themeData, aditionalDevicePixelRatio);
painter->restore();
return result;
}
-static inline QRect scaleRect(const QRect &r, int factor)
+static inline QRectF scaleRect(const QRectF &r, qreal factor)
{
return r.isValid() && factor > 1
- ? QRect(r.topLeft() * factor, r.size() * factor)
+ ? QRectF(r.topLeft() * factor, r.size() * factor)
: r;
}
-static QRegion scaleRegion(const QRegion &region, int factor)
+static QRegion scaleRegion(const QRegion &region, qreal factor)
{
- if (region.isEmpty() || factor == 1)
+ if (region.isEmpty() || qFuzzyCompare(factor, qreal(1)))
return region;
if (region.rectCount() == 1)
- return QRegion(scaleRect(region.boundingRect(), factor));
+ return QRegion(scaleRect(QRectF(region.boundingRect()), factor).toRect());
QRegion result;
foreach (const QRect &rect, region.rects())
- result += QRect(rect.topLeft() * factor, rect.size() * factor);
+ result += QRectF(QPointF(rect.topLeft()) * factor, QSizeF(rect.size() * factor)).toRect();
return result;
}
@@ -757,13 +757,12 @@ static QRegion scaleRegion(const QRegion &region, int factor)
Do not use this if you need to perform other transformations on the
resulting data.
*/
-bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int additionalDevicePixelRatio)
+bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeData, qreal additionalDevicePixelRatio)
{
QPainter *painter = themeData.painter;
- QPoint redirectionDelta(int(painter->deviceMatrix().dx()),
- int(painter->deviceMatrix().dy()));
- QRect area = scaleRect(themeData.rect, additionalDevicePixelRatio).translated(redirectionDelta);
+ const QPointF redirectionDelta(painter->deviceMatrix().dx(), painter->deviceMatrix().dy());
+ const QRect area = scaleRect(QRectF(themeData.rect), additionalDevicePixelRatio).translated(redirectionDelta).toRect();
QRegion sysRgn = painter->paintEngine()->systemClip();
if (sysRgn.isEmpty())
@@ -771,7 +770,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa
else
sysRgn &= area;
if (painter->hasClipping())
- sysRgn &= scaleRegion(painter->clipRegion(), additionalDevicePixelRatio).translated(redirectionDelta);
+ sysRgn &= scaleRegion(painter->clipRegion(), additionalDevicePixelRatio).translated(redirectionDelta.toPoint());
HRGN hrgn = qt_hrgn_from_qregion(sysRgn);
SelectClipRgn(dc, hrgn);
@@ -806,15 +805,16 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa
engine).
*/
bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData,
- int additionalDevicePixelRatio)
+ qreal additionalDevicePixelRatio)
{
QPainter *painter = themeData.painter;
- QRect rect = scaleRect(themeData.rect, additionalDevicePixelRatio);
+ QRectF rectF = scaleRect(QRectF(themeData.rect), additionalDevicePixelRatio);
if ((themeData.rotate + 90) % 180 == 0) { // Catch 90,270,etc.. degree flips.
- rect = QRect(0, 0, rect.height(), rect.width());
+ rectF = QRectF(0, 0, rectF.height(), rectF.width());
}
- rect.moveTo(0,0);
+ rectF.moveTo(0, 0);
+ QRect rect = rectF.toRect();
int partId = themeData.partId;
int stateId = themeData.stateId;
int w = rect.width();
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 7cbccdaf67..d6702c8803 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -240,8 +240,8 @@ public:
void setTransparency(QWidget *widget, XPThemeData &themeData);
bool drawBackground(XPThemeData &themeData);
- bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, int aditionalDevicePixelRatio);
- bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int aditionalDevicePixelRatio);
+ bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, qreal aditionalDevicePixelRatio);
+ bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, qreal aditionalDevicePixelRatio);
bool hasAlphaChannel(const QRect &rect);
bool fixAlphaChannel(const QRect &rect);
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 12071e2cf0..b0ded70c4a 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -213,10 +213,9 @@ QString QCalendarDayValidator::text(const QDate &date, int repeat) const
return formatNumber(date.day(), 2);
} else if (repeat == 3) {
return m_locale.dayName(date.dayOfWeek(), QLocale::ShortFormat);
- } else if (repeat >= 4) {
+ } else /* repeat >= 4 */ {
return m_locale.dayName(date.dayOfWeek(), QLocale::LongFormat);
}
- return QString();
}
//////////////////////////////////
@@ -3030,6 +3029,7 @@ bool QCalendarWidget::event(QEvent *event)
switch (event->type()) {
case QEvent::LayoutDirectionChange:
d->updateButtonIcons();
+ break;
case QEvent::LocaleChange:
d->m_model->setFirstColumnDay(locale().firstDayOfWeek());
d->cachedSizeHint = QSize();
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index a30e5db405..52e7962109 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1684,6 +1684,9 @@ void QComboBox::setIconSize(const QSize &size)
By default, this property is \c false. The effect of editing depends
on the insert policy.
+ \note When disabling the \a editable state, the validator and
+ completer are removed.
+
\sa InsertPolicy
*/
bool QComboBox::isEditable() const
@@ -1837,6 +1840,8 @@ QLineEdit *QComboBox::lineEdit() const
\fn void QComboBox::setValidator(const QValidator *validator)
Sets the \a validator to use instead of the current validator.
+
+ \note The validator is removed when the editable property becomes \c false.
*/
void QComboBox::setValidator(const QValidator *v)
@@ -1870,6 +1875,8 @@ const QValidator *QComboBox::validator() const
By default, for an editable combo box, a QCompleter that
performs case insensitive inline completion is automatically created.
+
+ \note The completer is removed when the \a editable property becomes \c false.
*/
void QComboBox::setCompleter(QCompleter *c)
{
@@ -3126,6 +3133,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
case Qt::Key_Up:
if (e->modifiers() & Qt::ControlModifier)
break; // pass to line edit for auto completion
+ // fall through
case Qt::Key_PageUp:
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled())
@@ -3168,6 +3176,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
showPopup();
return;
}
+ break;
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Escape:
@@ -3212,6 +3221,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
switch (move) {
case MoveFirst:
newIndex = -1;
+ // fall through
case MoveDown:
newIndex++;
while (newIndex < rowCount && !(d->model->index(newIndex, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled))
@@ -3219,6 +3229,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
break;
case MoveLast:
newIndex = rowCount;
+ // fall through
case MoveUp:
newIndex--;
while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled))
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index da370b4a19..c5eab55a53 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2350,7 +2350,9 @@ void QDateTimeEditPrivate::interpret(EmitPolicy ep)
const QValidator::State state = q->validate(tmp, pos);
if (state != QValidator::Acceptable
&& correctionMode == QAbstractSpinBox::CorrectToPreviousValue
- && (state == QValidator::Invalid || !(fieldInfo(currentSectionIndex) & AllowPartial))) {
+ && (state == QValidator::Invalid
+ || currentSectionIndex < 0
+ || !(fieldInfo(currentSectionIndex) & AllowPartial))) {
setValue(value, ep);
updateTimeSpec();
} else {
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 5c79c64793..e32e379198 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -682,8 +682,10 @@ QWidget *QMainWindow::takeCentralWidget()
{
Q_D(QMainWindow);
QWidget *oldcentralwidget = d->layout->centralWidget();
- oldcentralwidget->setParent(0);
- d->layout->setCentralWidget(0);
+ if (oldcentralwidget) {
+ oldcentralwidget->setParent(0);
+ d->layout->setCentralWidget(0);
+ }
return oldcentralwidget;
}
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 8aa06e9a4d..6e34198f67 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -176,7 +176,12 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex)
if (tab.textColor.isValid())
option->palette.setColor(q->foregroundRole(), tab.textColor);
-
+#ifdef Q_OS_MACOS
+ else if (isCurrent && !documentMode
+ && (QSysInfo::MacintoshVersion < QSysInfo::MV_10_10 || q->isActiveWindow())) {
+ option->palette.setColor(QPalette::WindowText, Qt::white);
+ }
+#endif
option->icon = tab.icon;
option->iconSize = q->iconSize(); // Will get the default value then.
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index 05564bb6b1..0c57d9251d 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -604,16 +604,21 @@ int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const
case QInternal::LeftDock:
if (pos.y() < rect.bottom())
return pos.x() - rect.right();
+ break;
case QInternal::RightDock:
if (pos.y() < rect.bottom())
return rect.left() - pos.x();
+ break;
case QInternal::TopDock:
if (pos.x() < rect.right())
return pos.y() - rect.bottom();
+ break;
case QInternal::BottomDock:
if (pos.x() < rect.right())
return rect.top() - pos.y();
- default:
+ break;
+
+ case QInternal::DockCount:
break;
}
return -1;