summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-02-16 08:54:58 +0100
committerLiang Qi <liang.qi@qt.io>2018-02-16 08:54:58 +0100
commit942ab490724fcc9544e786e5783718e1a07aa50b (patch)
treefeb7d3ff716edb37b2ca60e33c05adf8777bd964 /src/widgets
parent0fb8271a467202990c90321066e40faed640a7a8 (diff)
parent24adaa9a742e6f95ff897d0eb9a2bce0527dd042 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: src/corelib/tools/tools.pri Change-Id: I705630f9cecbf0ce51a22fc6116b8c49611259e9
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp5
-rw-r--r--src/widgets/doc/src/qtwidgets-index.qdoc11
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp6
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp8
-rw-r--r--src/widgets/itemviews/qheaderview.cpp88
-rw-r--r--src/widgets/itemviews/qheaderview_p.h11
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/kernel/qaction.cpp5
-rw-r--r--src/widgets/kernel/qapplication.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp3
-rw-r--r--src/widgets/styles/qfusionstyle.cpp33
-rw-r--r--src/widgets/styles/qstylehelper.cpp8
-rw-r--r--src/widgets/styles/qstylehelper_p.h1
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp5
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp7
-rw-r--r--src/widgets/widgets.pro2
-rw-r--r--src/widgets/widgets/qcombobox.cpp4
-rw-r--r--src/widgets/widgets/qlineedit.cpp5
-rw-r--r--src/widgets/widgets/qtoolbarextension.cpp20
-rw-r--r--src/widgets/widgets/qtoolbarextension_p.h6
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp5
21 files changed, 158 insertions, 79 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 4cda5f34ad..3d91bdef34 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -2830,7 +2830,10 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter,
if (!nameFilter.isEmpty())
q->setNameFilter(nameFilter);
q->setDirectoryUrl(workingDirectory(directory));
- q->selectFile(initialSelection(directory));
+ if (directory.isLocalFile())
+ q->selectFile(initialSelection(directory));
+ else
+ q->selectUrl(directory);
#ifndef QT_NO_SETTINGS
// Try to restore from the FileDialog settings group; if it fails, fall back
diff --git a/src/widgets/doc/src/qtwidgets-index.qdoc b/src/widgets/doc/src/qtwidgets-index.qdoc
index 7cd1c8d735..1a23d172dd 100644
--- a/src/widgets/doc/src/qtwidgets-index.qdoc
+++ b/src/widgets/doc/src/qtwidgets-index.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -128,6 +128,15 @@ interfaces
\image graphicsview-items.png
+ \section1 Licenses
+
+ The Qt Widgets module is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under free software licenses. Since Qt 5.4,
+ these free software licenses are
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
\section1 Related Information
\section2 Tutorials
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 1cc8543fdd..0c847b899e 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -313,13 +313,15 @@ void QGraphicsViewPrivate::translateTouchEvent(QGraphicsViewPrivate *d, QTouchEv
QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints();
for (int i = 0; i < touchPoints.count(); ++i) {
QTouchEvent::TouchPoint &touchPoint = touchPoints[i];
+ const QSizeF ellipseDiameters = touchPoint.ellipseDiameters();
// the scene will set the item local pos, startPos, lastPos, and rect before delivering to
// an item, but for now those functions are returning the view's local coordinates
- touchPoint.setSceneRect(d->mapToScene(touchPoint.rect()));
+ touchPoint.setScenePos(d->mapToScene(touchPoint.pos()));
touchPoint.setStartScenePos(d->mapToScene(touchPoint.startPos()));
touchPoint.setLastScenePos(d->mapToScene(touchPoint.lastPos()));
+ touchPoint.setEllipseDiameters(ellipseDiameters);
- // screenPos, startScreenPos, lastScreenPos, and screenRect are already set
+ // screenPos, startScreenPos, and lastScreenPos are already set
}
touchEvent->setTouchPoints(touchPoints);
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 3268fda2fc..117de8edf9 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -526,7 +526,15 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
if (tryFixup(editor))
emit q->commitData(editor);
+ // If the application loses focus while editing, then the focus needs to go back
+ // to the itemview when the editor closes. This ensures that when the application
+ // is active again it will have the focus on the itemview as expected.
+ const bool manuallyFixFocus = (event->type() == QEvent::FocusOut) && !editor->hasFocus() &&
+ editor->parentWidget() &&
+ (static_cast<QFocusEvent *>(event)->reason() == Qt::ActiveWindowFocusReason);
emit q->closeEditor(editor, QAbstractItemDelegate::NoHint);
+ if (manuallyFixFocus)
+ editor->parentWidget()->setFocus();
}
#ifndef QT_NO_SHORTCUT
} else if (event->type() == QEvent::ShortcutOverride) {
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 585cfddff5..c90a61d4ff 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -351,7 +351,7 @@ void QHeaderView::setModel(QAbstractItemModel *model)
if (model == this->model())
return;
Q_D(QHeaderView);
- d->persistentHiddenSections.clear();
+ d->layoutChangePersistentSections.clear();
if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
if (d->orientation == Qt::Horizontal) {
QObject::disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),
@@ -2160,14 +2160,28 @@ void QHeaderViewPrivate::_q_sectionsAboutToBeChanged()
|| model->columnCount(root) == 0)
return;
- if (hiddenSectionSize.count() == 0)
- return;
+ layoutChangePersistentSections.clear();
+ layoutChangePersistentSections.reserve(std::min(10, sectionItems.count()));
+ // after layoutChanged another section can be last stretched section
+ if (stretchLastSection) {
+ const int visual = visualIndex(lastSectionLogicalIdx);
+ sectionItems[visual].size = lastSectionSize;
+ }
+ for (int i = 0; i < sectionItems.size(); ++i) {
+ const auto &s = sectionItems.at(i);
+ // only add if the section is not default and not visually moved
+ if (s.size == defaultSectionSize && !s.isHidden && s.resizeMode == globalResizeMode)
+ continue;
- for (int i = 0; i < sectionItems.count(); ++i)
- if (isVisualIndexHidden(i)) // ### note that we are using column or row 0
- persistentHiddenSections.append(orientation == Qt::Horizontal
- ? model->index(0, logicalIndex(i), root)
- : model->index(logicalIndex(i), 0, root));
+ // ### note that we are using column or row 0
+ layoutChangePersistentSections.append({orientation == Qt::Horizontal
+ ? model->index(0, logicalIndex(i), root)
+ : model->index(logicalIndex(i), 0, root),
+ s});
+
+ if (layoutChangePersistentSections.size() > 1000)
+ break;
+ }
}
void QHeaderViewPrivate::_q_sectionsChanged()
@@ -2175,25 +2189,57 @@ void QHeaderViewPrivate::_q_sectionsChanged()
Q_Q(QHeaderView);
viewport->update();
- const auto hiddenSections = persistentHiddenSections;
- persistentHiddenSections.clear();
-
- clear();
- q->initializeSections();
- invalidateCachedSizeHint();
+ const auto oldPersistentSections = layoutChangePersistentSections;
+ layoutChangePersistentSections.clear();
- if (modelIsEmpty()) {
+ const int newCount = modelSectionCount();
+ const int oldCount = sectionItems.size();
+ if (newCount == 0) {
+ clear();
+ if (oldCount != 0)
+ emit q->sectionCountChanged(oldCount, 0);
return;
}
- for (const auto &index : hiddenSections) {
- if (index.isValid()) {
- const int logical = (orientation == Qt::Horizontal
- ? index.column()
- : index.row());
- q->setSectionHidden(logical, true);
+ // adjust section size
+ if (newCount != oldCount) {
+ const int min = qBound(0, oldCount, newCount - 1);
+ q->initializeSections(min, newCount - 1);
+ }
+ // reset sections
+ sectionItems.fill(SectionItem(defaultSectionSize, globalResizeMode), newCount);
+
+ // all hidden sections are in oldPersistentSections
+ hiddenSectionSize.clear();
+
+ for (const auto &item : oldPersistentSections) {
+ const auto &index = item.index;
+ if (!index.isValid())
+ continue;
+
+ const int newLogicalIndex = (orientation == Qt::Horizontal
+ ? index.column()
+ : index.row());
+ // the new visualIndices are already adjusted / reset by initializeSections()
+ const int newVisualIndex = visualIndex(newLogicalIndex);
+ auto &newSection = sectionItems[newVisualIndex];
+ newSection = item.section;
+
+ if (newSection.isHidden) {
+ // otherwise setSectionHidden will return without doing anything
+ newSection.isHidden = false;
+ q->setSectionHidden(newLogicalIndex, true);
}
}
+
+ recalcSectionStartPos();
+ length = headerLength();
+
+ if (stretchLastSection) {
+ // force rebuild of stretched section later on
+ lastSectionLogicalIdx = -1;
+ maybeRestorePrevLastSectionAndStretchLast();
+ }
}
/*!
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index d844274618..24dc3bf075 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -231,10 +231,6 @@ public:
: model->rowCount(root));
}
- inline bool modelIsEmpty() const {
- return (model->rowCount(root) == 0 || model->columnCount(root) == 0);
- }
-
inline void doDelayedResizeSections() {
if (!delayedResize.isActive())
delayedResize.start(0, q_func());
@@ -300,7 +296,6 @@ public:
QLabel *sectionIndicator;
#endif
QHeaderView::ResizeMode globalResizeMode;
- QList<QPersistentModelIndex> persistentHiddenSections;
mutable bool sectionStartposRecalc;
int resizeContentsPrecision;
// header sections
@@ -331,6 +326,11 @@ public:
};
QVector<SectionItem> sectionItems;
+ struct LayoutChangeItem {
+ QPersistentModelIndex index;
+ SectionItem section;
+ };
+ QVector<LayoutChangeItem> layoutChangePersistentSections;
void createSectionItems(int start, int end, int size, QHeaderView::ResizeMode mode);
void removeSectionsFromSectionItems(int start, int end);
@@ -384,6 +384,7 @@ public:
};
Q_DECLARE_TYPEINFO(QHeaderViewPrivate::SectionItem, Q_PRIMITIVE_TYPE);
+Q_DECLARE_TYPEINFO(QHeaderViewPrivate::LayoutChangeItem, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 9b7797993c..ebeefad682 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -987,7 +987,7 @@ void QTreeView::setTreePosition(int index)
{
Q_D(QTreeView);
d->treePosition = index;
- update();
+ d->viewport->update();
}
/*!
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 967b0b8dde..8c8217bb75 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -1332,9 +1332,8 @@ bool QAction::isShortcutVisibleInContextMenu() const
{
Q_D(const QAction);
if (d->shortcutVisibleInContextMenu == -1) {
- if (QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus))
- return false;
- return qApp->styleHints()->showShortcutsInContextMenus();
+ return !QCoreApplication::testAttribute(Qt::AA_DontShowShortcutsInContextMenus)
+ && QGuiApplication::styleHints()->showShortcutsInContextMenus();
}
return d->shortcutVisibleInContextMenu;
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 9e4910ebd0..b855e32f2d 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2847,7 +2847,7 @@ void QApplication::setStartDragDistance(int l)
and the current position (e.g. in the mouse move event) is \c currentPos,
you can find out if a drag should be started with code like this:
- \snippet code/src_gui_kernel_qapplication.cpp 6
+ \snippet code/src_gui_kernel_qapplication.cpp 7
Qt uses this value internally, e.g. in QFileDialog.
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index bc5062e942..74f2dc0c41 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1482,7 +1482,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (q->windowType() != Qt::Desktop || q->testAttribute(Qt::WA_NativeWindow)) {
win->create();
// Enable nonclient-area events for QDockWidget and other NonClientArea-mouse event processing.
- win->handle()->setFrameStrutEventsEnabled(true);
+ if (QPlatformWindow *platformWindow = win->handle())
+ platformWindow->setFrameStrutEventsEnabled(true);
}
data.window_flags = win->flags();
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 26f651906a..6873ca876e 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -763,7 +763,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
painter->drawRect(rect);
QColor checkMarkColor = option->palette.text().color().darker(120);
- const int checkMarkPadding = 1 + rect.width() * 0.2; // at least one pixel padding
+ const qreal checkMarkPadding = 1 + rect.width() * 0.13; // at least one pixel padding
if (checkbox->state & State_NoChange) {
gradient = QLinearGradient(rect.topLeft(), rect.bottomLeft());
@@ -776,21 +776,22 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
painter->setBrush(gradient);
painter->drawRect(rect.adjusted(checkMarkPadding, checkMarkPadding, -checkMarkPadding, -checkMarkPadding));
- } else if (checkbox->state & (State_On)) {
- qreal penWidth = QStyleHelper::dpiScaled(1.8);
- penWidth = qMax(penWidth , 0.18 * rect.height());
- penWidth = qMin(penWidth , 0.30 * rect.height());
+ } else if (checkbox->state & State_On) {
+ qreal penWidth = QStyleHelper::dpiScaled(1.5);
+ penWidth = qMax(penWidth , 0.13 * rect.height());
+ penWidth = qMin(penWidth , 0.20 * rect.height());
QPen checkPen = QPen(checkMarkColor, penWidth);
checkMarkColor.setAlpha(210);
- painter->translate(-0.8, 0.5);
+ painter->translate(dpiScaled(-0.8), dpiScaled(0.5));
painter->setPen(checkPen);
painter->setBrush(Qt::NoBrush);
// Draw checkmark
QPainterPath path;
- path.moveTo(1.33 * checkMarkPadding, rect.height() / 2.0);
- path.lineTo(rect.width() / 2.0, rect.height() - checkMarkPadding);
- path.lineTo(rect.width() - checkMarkPadding * 0.92, checkMarkPadding);
+ const qreal rectHeight = rect.height(); // assuming height equals width
+ path.moveTo(checkMarkPadding + rectHeight * 0.11, rectHeight * 0.47);
+ path.lineTo(rectHeight * 0.5, rectHeight - checkMarkPadding);
+ path.lineTo(rectHeight - checkMarkPadding, checkMarkPadding);
painter->drawPath(path.translated(rect.topLeft()));
}
}
@@ -1561,8 +1562,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
bool ignoreCheckMark = false;
const int checkColHOffset = windowsItemHMargin + windowsItemFrame - 1;
- int checkcol = qMax(menuItem->rect.height() * 0.7,
- qMax(menuItem->maxIconWidth * 1.0, dpiScaled(17))); // icon checkbox's highlihgt column width
+ int checkcol = qMax(menuItem->rect.height() * 0.79,
+ qMax(menuItem->maxIconWidth * 1.0, dpiScaled(21))); // icon checkbox's highlihgt column width
if (
#if QT_CONFIG(combobox)
qobject_cast<const QComboBox*>(widget) ||
@@ -1571,10 +1572,12 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate
if (!ignoreCheckMark) {
- // Check
- const int boxMargin = dpiScaled(4);
- const int boxWidth = checkcol - 2 * boxMargin;
- QRect checkRect(option->rect.left() + boxMargin + checkColHOffset, option->rect.center().y() - boxWidth/2 + 1, boxWidth, boxWidth);
+ // Check, using qreal and QRectF to avoid error accumulation
+ const qreal boxMargin = dpiScaled(3.5);
+ const qreal boxWidth = checkcol - 2 * boxMargin;
+ QRectF checkRectF(option->rect.left() + boxMargin + checkColHOffset, option->rect.center().y() - boxWidth/2 + 1, boxWidth, boxWidth);
+ QRect checkRect = checkRectF.toRect();
+ checkRect.setWidth(checkRect.height()); // avoid .toRect() round error results in non-perfect square
checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect);
if (checkable) {
if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 373699a7aa..8679d96eda 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -411,14 +411,6 @@ QWindow *styleObjectWindow(QObject *so)
return 0;
}
-void setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy policy)
-{
- QWidget *wadget = const_cast<QWidget *>(widget);
- wadget->setAttribute(Qt::WA_MacNormalSize, policy == SizeLarge);
- wadget->setAttribute(Qt::WA_MacSmallSize, policy == SizeSmall);
- wadget->setAttribute(Qt::WA_MacMiniSize, policy == SizeMini);
-}
-
WidgetSizePolicy widgetSizePolicy(const QWidget *widget, const QStyleOption *opt)
{
while (widget) {
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index bd263cea7b..260860bf4d 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -94,7 +94,6 @@ namespace QStyleHelper
enum WidgetSizePolicy { SizeLarge = 0, SizeSmall = 1, SizeMini = 2, SizeDefault = -1 };
- void setWidgetSizePolicy(const QWidget *w, WidgetSizePolicy policy);
Q_WIDGETS_EXPORT WidgetSizePolicy widgetSizePolicy(const QWidget *w, const QStyleOption *opt = 0);
}
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 9ce1a04d86..e12aeb900b 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3968,10 +3968,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
x += reverse ? -chunkWidth : chunkWidth;
--chunkCount;
};
- } else {
+ } else if (chunkWidth > 0) {
+ const int chunkCount = ceil(qreal(fillWidth)/chunkWidth);
int x = reverse ? r.left() + r.width() - chunkWidth : r.x();
- for (int i = 0; i < ceil(qreal(fillWidth)/chunkWidth); ++i) {
+ for (int i = 0; i < chunkCount; ++i) {
r.setRect(x, rect.y(), chunkWidth, rect.height());
r = m.mapRect(QRectF(r)).toRect();
subRule.drawRule(p, r);
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 447c7b2aeb..86c824afdb 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -111,9 +111,7 @@ static QIcon messageIcon2qIcon(QSystemTrayIcon::MessageIcon icon)
\li All X11 desktop environments that implement the D-Bus
\l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem}
specification, including recent versions of KDE and Unity.
- \li All supported versions of \macos. Note that the Growl
- notification system must be installed for
- QSystemTrayIcon::showMessage() to display messages on \macos prior to 10.8 (Mountain Lion).
+ \li All supported versions of \macos.
\endlist
To check whether a system tray is present on the user's desktop,
@@ -420,9 +418,6 @@ bool QSystemTrayIcon::supportsMessages()
On Windows, the \a millisecondsTimeoutHint is usually ignored by the system
when the application has focus.
- On \macos, the Growl notification system must be installed for this function to
- display messages.
-
Has been turned into a slot in Qt 5.2.
\sa show(), supportsMessages()
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index 27d7fe9874..e028a691c8 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -4,7 +4,7 @@ MODULE_CONFIG = uic
CONFIG += $$MODULE_CONFIG
DEFINES += QT_NO_USING_NAMESPACE
-win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
+msvc:equals(QT_ARCH, i386): QMAKE_LFLAGS += /BASE:0x65000000
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 7d4498af5b..e70d096e04 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -67,6 +67,7 @@
#include <qabstractproxymodel.h>
#include <qstylehints.h>
#include <private/qguiapplication_p.h>
+#include <private/qhighdpiscaling_p.h>
#include <private/qapplication_p.h>
#include <private/qcombobox_p.h>
#include <private/qabstractitemmodel_p.h>
@@ -2582,7 +2583,8 @@ bool QComboBoxPrivate::showNativePopup()
else if (q->testAttribute(Qt::WA_MacMiniSize))
offset = QPoint(-2, 6);
- m_platformMenu->showPopup(tlw, QRect(tlw->mapFromGlobal(q->mapToGlobal(offset)), QSize()), currentItem);
+ const QRect targetRect = QRect(tlw->mapFromGlobal(q->mapToGlobal(offset)), QSize());
+ m_platformMenu->showPopup(tlw, QHighDpi::toNativePixels(targetRect, tlw), currentItem);
#ifdef Q_OS_OSX
// The Cocoa popup will swallow any mouse release event.
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index e3b348f0ef..bdeef7cdf7 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -80,9 +80,8 @@
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include "qkeysequence.h"
-#define ACCEL_KEY(k) ((qApp->testAttribute(Qt::AA_DontShowIconsInMenus) \
- ? false \
- : qApp->styleHints()->showShortcutsInContextMenus()) \
+#define ACCEL_KEY(k) ((!QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus) \
+ && QGuiApplication::styleHints()->showShortcutsInContextMenus()) \
&& !qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \
QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString())
#else
diff --git a/src/widgets/widgets/qtoolbarextension.cpp b/src/widgets/widgets/qtoolbarextension.cpp
index 47cf16e0cc..bbe7eddaa4 100644
--- a/src/widgets/widgets/qtoolbarextension.cpp
+++ b/src/widgets/widgets/qtoolbarextension.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qtoolbarextension_p.h"
-#include <qpixmap.h>
+#include <qevent.h>
#include <qstyle.h>
#include <qstylepainter.h>
#include <qstyleoption.h>
@@ -47,10 +47,11 @@ QT_BEGIN_NAMESPACE
QToolBarExtension::QToolBarExtension(QWidget *parent)
: QToolButton(parent)
+ , m_orientation(Qt::Horizontal)
{
setObjectName(QLatin1String("qt_toolbar_ext_button"));
setAutoRaise(true);
- setOrientation(Qt::Horizontal);
+ setOrientation(m_orientation);
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
setCheckable(true);
}
@@ -63,7 +64,8 @@ void QToolBarExtension::setOrientation(Qt::Orientation o)
setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, &opt));
} else {
setIcon(style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton, &opt));
- }
+ }
+ m_orientation = o;
}
void QToolBarExtension::paintEvent(QPaintEvent *)
@@ -83,6 +85,18 @@ QSize QToolBarExtension::sizeHint() const
return QSize(ext, ext);
}
+bool QToolBarExtension::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::LayoutDirectionChange:
+ setOrientation(m_orientation);
+ break;
+ default:
+ break;
+ }
+ return QToolButton::event(event);
+}
+
QT_END_NAMESPACE
#include "moc_qtoolbarextension_p.cpp"
diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h
index a388f1e40f..146e0e58c1 100644
--- a/src/widgets/widgets/qtoolbarextension_p.h
+++ b/src/widgets/widgets/qtoolbarextension_p.h
@@ -69,6 +69,12 @@ public:
public Q_SLOTS:
void setOrientation(Qt::Orientation o);
+
+protected:
+ bool event(QEvent *e) override;
+
+private:
+ Qt::Orientation m_orientation;
};
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 93158dcdba..d3203e180b 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -93,9 +93,8 @@
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include <qkeysequence.h>
-#define ACCEL_KEY(k) ((qApp->testAttribute(Qt::AA_DontShowIconsInMenus) \
- ? false \
- : qApp->styleHints()->showShortcutsInContextMenus()) \
+#define ACCEL_KEY(k) ((!QCoreApplication::testAttribute(Qt::AA_DontShowShortcutsInContextMenus) \
+ && QGuiApplication::styleHints()->showShortcutsInContextMenus()) \
&& !qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \
QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString())