summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-29 13:51:16 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-29 15:30:17 +0200
commit1cc571593a67f3e688a5cbb896f0be71ca5a2b30 (patch)
treec652360c9276cbf475244fd02313d64e3df11a96 /src/widgets
parent829c59aa4acf94bd979f6a3162808be36802d79a (diff)
parentcc74452d6d259d36ac47c536f11a5efb269e8e44 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
cf53aa21bf0f8fbd13c0ce2d33ddf7bc63d0d76a and 3aaa5d6b32130d3eeac872a59a5a44bfb20dfd4a were reverted because of reconstruction in 5.7. defineTest(qtConfTest_checkCompiler) in configure.pri is smart enough to cover the case in a9474d1260a8c8cc9eae14f2984098919d9684e5. DirectWrite: Fix advances being scaled to 0 Since 131eee5cd, the stretch of a font can be 0, meaning "whatever the font provides". In combination with ec7fee96, this would cause advances in the DirectWrite engine to be scaled to 0, causing the QRawFont test to fail. Conflicts: configure mkspecs/features/uikit/device_destinations.sh mkspecs/features/uikit/xcodebuild.mk src/corelib/global/qglobal.cpp src/corelib/global/qnamespace.qdoc src/plugins/platforms/cocoa/qcocoamenuitem.h src/plugins/platforms/windows/qwindowsservices.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp src/widgets/kernel/qapplication.cpp tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp3
-rw-r--r--src/widgets/dialogs/qdialog.cpp2
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp5
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp12
-rw-r--r--src/widgets/dialogs/qsidebar.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp1
-rw-r--r--src/widgets/kernel/qapplication.cpp17
-rw-r--r--src/widgets/kernel/qwidget.cpp67
-rw-r--r--src/widgets/kernel/qwidget_p.h3
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp22
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp11
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp22
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp2
-rw-r--r--src/widgets/widgets/qmenu.cpp6
-rw-r--r--src/widgets/widgets/qmenubar.cpp19
15 files changed, 106 insertions, 90 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index d4764c019e..1116685fc7 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -2172,7 +2172,8 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr
QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
{
- QColor color(getColor(QColor(initial), parent, QString(), ShowAlphaChannel));
+ const QColor color = getColor(QColor::fromRgba(initial), parent, QString(),
+ ShowAlphaChannel);
QRgb result = color.isValid() ? color.rgba() : initial;
if (ok)
*ok = color.isValid();
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index cdf9a01f0f..e8883df527 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -95,7 +95,7 @@ QPlatformDialogHelper *QDialogPrivate::platformHelper() const
{
// Delayed creation of the platform, ensuring that
// that qobject_cast<> on the dialog works in the plugin.
- if (!m_platformHelperCreated) {
+ if (!m_platformHelperCreated && canBeNativeDialog()) {
m_platformHelperCreated = true;
QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
QDialog *dialog = ncThis->q_func();
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index b4ca853c5d..7b60e9cb56 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -2414,8 +2414,7 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent,
native file dialog and not a QFileDialog. However, the native Windows file
dialog does not support displaying files in the directory chooser. You need
to pass \l{QFileDialog::}{DontUseNativeDialog} to display files using a
- QFileDialog. On Windows CE, if the device has no native file dialog, a
- QFileDialog will be used.
+ QFileDialog.
On Unix/X11, the normal behavior of the file dialog is to resolve and
follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp},
@@ -2792,7 +2791,7 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter,
}
q->setAcceptMode(QFileDialog::AcceptOpen);
- nativeDialogInUse = (canBeNativeDialog() && platformFileDialogHelper() != 0);
+ nativeDialogInUse = platformFileDialogHelper() != 0;
if (!nativeDialogInUse)
createWidgets();
q->setFileMode(QFileDialog::AnyFile);
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 1c4166c567..5118383fe5 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -818,10 +818,8 @@ void QFontDialog::setCurrentFont(const QFont &font)
d->strikeout->setChecked(font.strikeOut());
d->underline->setChecked(font.underline());
d->updateFamilies();
- if (d->canBeNativeDialog()) {
- if (QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
- helper->setCurrentFont(font);
- }
+ if (QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
+ helper->setCurrentFont(font);
}
/*!
@@ -834,10 +832,8 @@ void QFontDialog::setCurrentFont(const QFont &font)
QFont QFontDialog::currentFont() const
{
Q_D(const QFontDialog);
- if (d->canBeNativeDialog()) {
- if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
- return helper->currentFont();
- }
+ if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
+ return helper->currentFont();
return d->sampleEdit->font();
}
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index d86cddab61..713ccb6556 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -198,7 +198,9 @@ void QUrlModel::setUrl(const QModelIndex &index, const QUrl &url, const QModelIn
QIcon newIcon = qvariant_cast<QIcon>(dirIndex.data(Qt::DecorationRole));
if (!dirIndex.isValid()) {
- newIcon = fileSystemModel->iconProvider()->icon(QFileIconProvider::Folder);
+ const QFileIconProvider *provider = fileSystemModel->iconProvider();
+ if (provider)
+ newIcon = provider->icon(QFileIconProvider::Folder);
newName = QFileInfo(url.toLocalFile()).fileName();
if (!invalidUrls.contains(url))
invalidUrls.append(url);
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index ebe1e93fe8..0b9e6e7216 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -544,6 +544,7 @@ QGraphicsProxyWidget::~QGraphicsProxyWidget()
{
Q_D(QGraphicsProxyWidget);
if (d->widget) {
+ d->widget->removeEventFilter(this);
QObject::disconnect(d->widget, SIGNAL(destroyed()), this, SLOT(_q_removeWidgetSlot()));
delete d->widget;
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index afc1be7458..9b8677e6a8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1010,8 +1010,8 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
the WA_InputMethodEnabled attribute set, and is typically used to launch
a virtual keyboard on devices which have very few or no keys.
- \b{ The property only has an effect on platforms which use software input
- panels, such as Windows CE.}
+ \b{ The property only has an effect on platforms that use software input
+ panels.}
The default is platform dependent.
*/
@@ -3869,12 +3869,7 @@ void QApplicationPrivate::openPopup(QWidget *popup)
/*!
Sets the kind of focus navigation Qt should use to \a mode.
- This feature is available in Qt for Embedded Linux, and Windows CE
- only.
-
- \note On Windows CE this feature is disabled by default for touch device
- mkspecs. To enable keypad navigation, build Qt with
- QT_KEYPAD_NAVIGATION defined.
+ This feature is available in Qt for Embedded Linux only.
\since 4.6
@@ -3888,11 +3883,7 @@ void QApplication::setNavigationMode(Qt::NavigationMode mode)
/*!
Returns what kind of focus navigation Qt is using.
- This feature is available in Qt for Embedded Linux, and Windows CE only.
-
- \note On Windows CE this feature is disabled by default for touch device
- mkspecs. To enable keypad navigation, build Qt with
- QT_KEYPAD_NAVIGATION defined.
+ This feature is available in Qt for Embedded Linux only.
\since 4.6
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 2e3d1cf9f8..bfadd69db5 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1432,6 +1432,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->setProperty("_q_showWithoutActivating", QVariant(true));
if (q->testAttribute(Qt::WA_MacAlwaysShowToolWindow))
win->setProperty("_q_macAlwaysShowToolWindow", QVariant::fromValue(QVariant(true)));
+ setNetWmWindowTypes(true); // do nothing if none of WA_X11NetWmWindowType* is set
win->setFlags(data.window_flags);
fixPosIncludesFrame();
if (q->testAttribute(Qt::WA_Moved)
@@ -1477,6 +1478,9 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
data.window_flags = win->flags();
+ if (!topData()->role.isNull())
+ QXcbWindowFunctions::setWmWindowRole(win, topData()->role.toLatin1());
+
QBackingStore *store = q->backingStore();
if (!store) {
@@ -6353,13 +6357,11 @@ QString QWidget::windowRole() const
*/
void QWidget::setWindowRole(const QString &role)
{
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
Q_D(QWidget);
+ d->createTLExtra();
d->topData()->role = role;
- d->setWindowRole();
-#else
- Q_UNUSED(role)
-#endif
+ if (windowHandle())
+ QXcbWindowFunctions::setWmWindowRole(windowHandle(), role.toLatin1());
}
/*!
@@ -10364,14 +10366,13 @@ void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags)
// the old type was a window and/or the new type is a window
QPoint oldPos = q->pos();
bool visible = q->isVisible();
+ const bool windowFlagChanged = (q->data->window_flags ^ flags) & Qt::Window;
q->setParent(q->parentWidget(), flags);
// if both types are windows or neither of them are, we restore
// the old position
- if (!((q->data->window_flags ^ flags) & Qt::Window)
- && (visible || q->testAttribute(Qt::WA_Moved))) {
+ if (!windowFlagChanged && (visible || q->testAttribute(Qt::WA_Moved)))
q->move(oldPos);
- }
// for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated.
adjustQuitOnCloseAttribute();
} else {
@@ -11252,7 +11253,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
}
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
case Qt::WA_X11NetWmWindowTypeDesktop:
case Qt::WA_X11NetWmWindowTypeDock:
case Qt::WA_X11NetWmWindowTypeToolBar:
@@ -11266,10 +11266,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
case Qt::WA_X11NetWmWindowTypeNotification:
case Qt::WA_X11NetWmWindowTypeCombo:
case Qt::WA_X11NetWmWindowTypeDND:
- if (testAttribute(Qt::WA_WState_Created))
- d->setNetWmWindowTypes();
+ d->setNetWmWindowTypes();
break;
-#endif
case Qt::WA_StaticContents:
if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
@@ -11325,9 +11323,7 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const
This feature is available on Embedded Linux, \macos, Windows,
and X11 platforms that support the Composite extension.
- This feature is not available on Windows CE.
-
- Note that under X11 you need to have a composite manager running,
+ \note On X11 you need to have a composite manager running,
and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be
supported by the window manager you are using.
@@ -12940,6 +12936,47 @@ void QWidgetPrivate::setWidgetParentHelper(QObject *widgetAsObject, QObject *new
widget->setParent(static_cast<QWidget*>(newParent));
}
+void QWidgetPrivate::setNetWmWindowTypes(bool skipIfMissing)
+{
+ Q_Q(QWidget);
+
+ if (!q->windowHandle())
+ return;
+
+ int wmWindowType = 0;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDesktop))
+ wmWindowType |= QXcbWindowFunctions::Desktop;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDock))
+ wmWindowType |= QXcbWindowFunctions::Dock;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeToolBar))
+ wmWindowType |= QXcbWindowFunctions::Toolbar;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeMenu))
+ wmWindowType |= QXcbWindowFunctions::Menu;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeUtility))
+ wmWindowType |= QXcbWindowFunctions::Utility;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeSplash))
+ wmWindowType |= QXcbWindowFunctions::Splash;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDialog))
+ wmWindowType |= QXcbWindowFunctions::Dialog;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu))
+ wmWindowType |= QXcbWindowFunctions::DropDownMenu;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypePopupMenu))
+ wmWindowType |= QXcbWindowFunctions::PopupMenu;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeToolTip))
+ wmWindowType |= QXcbWindowFunctions::Tooltip;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeNotification))
+ wmWindowType |= QXcbWindowFunctions::Notification;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeCombo))
+ wmWindowType |= QXcbWindowFunctions::Combo;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDND))
+ wmWindowType |= QXcbWindowFunctions::Dnd;
+
+ if (wmWindowType == 0 && skipIfMissing)
+ return;
+
+ QXcbWindowFunctions::setWmWindowType(q->windowHandle(), static_cast<QXcbWindowFunctions::WmWindowType>(wmWindowType));
+}
+
#ifndef QT_NO_DEBUG_STREAM
static inline void formatWidgetAttributes(QDebug debug, const QWidget *widget)
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index f2884e7b17..0a810df102 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -765,7 +765,6 @@ public:
void setWindowRole();
void sendStartupMessage(const char *message) const;
- void setNetWmWindowTypes();
void x11UpdateIsOpaque();
bool isBackgroundInherited() const;
void updateX11AcceptFocus();
@@ -862,6 +861,8 @@ public:
static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool);
void registerTouchWindow(bool enable = true);
#endif
+ void setNetWmWindowTypes(bool skipIfMissing = false);
+
bool stealKeyboardGrab(bool grab);
bool stealMouseGrab(bool grab);
};
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index c5904a5a96..690524b64b 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -210,7 +210,7 @@ enum PseudoElement {
struct PseudoElementInfo {
QStyle::SubControl subControl;
- const char *name;
+ const char name[19];
};
static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {
@@ -595,7 +595,7 @@ public:
Q_DECLARE_TYPEINFO(QRenderRule, Q_MOVABLE_TYPE);
///////////////////////////////////////////////////////////////////////////////////////////
-static const char *const knownStyleHints[] = {
+static const char knownStyleHints[][45] = {
"activate-on-singleclick",
"alignment",
"arrow-keys-navigate-into-children",
@@ -1002,15 +1002,17 @@ QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject
}
}
- if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
- QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle);
- if (!style)
- style = qobject_cast<QStyleSheetStyle *>(widget->style());
- if (style)
- fixupBorder(style->nativeFrameWidth(widget));
+ if (hasBorder()) {
+ if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
+ QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle);
+ if (!style)
+ style = qobject_cast<QStyleSheetStyle *>(widget->style());
+ if (style)
+ fixupBorder(style->nativeFrameWidth(widget));
+ }
+ if (border()->hasBorderImage())
+ defaultBackground = QBrush();
}
- if (hasBorder() && border()->hasBorderImage())
- defaultBackground = QBrush();
}
QRect QRenderRule::borderRect(const QRect& r) const
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index c2cce5770f..bf5aad0187 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -1175,9 +1175,9 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
case CE_MenuItem:
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
// windows always has a check column, regardless whether we have an icon or not
- const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
- int checkcol = qRound(qreal(25) / devicePixelRatio);
- const int gutterWidth = qRound(qreal(3) / devicePixelRatio);
+ const qreal factor = QWindowsXPStylePrivate::nativeMetricScaleFactor(widget);
+ int checkcol = qRound(qreal(25) * factor);
+ const int gutterWidth = qRound(qreal(3) * factor);
{
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::MenuTheme,
MENU_POPUPCHECKBACKGROUND, MBI_HOT);
@@ -2158,8 +2158,9 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
const bool isToolTitle = false;
const int height = tb->rect.height();
const int width = tb->rect.width();
- int buttonWidth = GetSystemMetrics(SM_CXSIZE) / QWindowsStylePrivate::devicePixelRatio(widget)
- - int(QStyleHelper::dpiScaled(4));
+ const int buttonWidth =
+ qRound(qreal(GetSystemMetrics(SM_CXSIZE)) * QWindowsStylePrivate::nativeMetricScaleFactor(widget)
+ - QStyleHelper::dpiScaled(4));
const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
const bool sysmenuHint = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0;
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index f3a8544d96..9d764d2a41 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -1923,7 +1923,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
themeNumber = QWindowsXPStylePrivate::StatusTheme;
partId = SP_GRIPPER;
XPThemeData theme(0, p, themeNumber, partId, 0);
- QSize size = (theme.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
+ QSize size = (theme.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize();
size.rheight()--;
if (const QStyleOptionSizeGrip *sg = qstyleoption_cast<const QStyleOptionSizeGrip *>(option)) {
switch (sg->corner) {
@@ -1994,7 +1994,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QWindowsXPStylePrivate::ToolBarTheme,
TP_SPLITBUTTONDROPDOWN);
if (theme.isValid()) {
- const QSize size = (theme.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
+ const QSize size = (theme.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize();
mbiw = size.width();
mbih = size.height();
}
@@ -2457,10 +2457,11 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QRect QWindowsXPStylePrivate::scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme)
{
const bool horizontal = flags & QStyle::State_Horizontal;
- const QMargins contentsMargin = (theme->margins(theme->rect, TMT_SIZINGMARGINS)
- / QWindowsStylePrivate::devicePixelRatio(widget)).toMargins();
+ const qreal factor = QWindowsStylePrivate::nativeMetricScaleFactor(widget);
+ const QMargins contentsMargin =
+ (theme->margins(theme->rect, TMT_SIZINGMARGINS) * factor).toMargins();
theme->partId = horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT;
- const QSize size = (theme->size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
+ const QSize size = (theme->size() * factor).toSize();
const int hSpace = theme->rect.width() - size.width();
const int vSpace = theme->rect.height() - size.height();
@@ -3618,12 +3619,13 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
{
XPThemeData buttontheme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL);
if (buttontheme.isValid()) {
- const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
- const QMarginsF borderSize = buttontheme.margins() / devicePixelRatio;
+ const qreal factor = QWindowsXPStylePrivate::nativeMetricScaleFactor(widget);
+ const QMarginsF borderSize = buttontheme.margins() * factor;
if (!borderSize.isNull()) {
- const qreal margin = qreal(2) / devicePixelRatio;
+ const qreal margin = qreal(2) * factor;
sz.rwidth() += qRound(borderSize.left() + borderSize.right() - margin);
- sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin + devicePixelRatio - 1);
+ sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin
+ + qreal(1) / factor - 1);
}
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)
@@ -3897,7 +3899,7 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme,
WP_RESTOREBUTTON, RBS_NORMAL);
if (theme.isValid()) {
- const QSize size = (themeSize.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
+ const QSize size = (themeSize.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize();
QPixmap pm(size);
pm.fill(Qt::transparent);
QPainter p(&pm);
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 5778d16456..494e30c7c7 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -1089,6 +1089,8 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
}
d->edit->event(event);
+ if (!d->edit->text().isEmpty())
+ d->cleared = false;
if (!isVisible())
d->ignoreUpdateEdit = true;
}
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index f4cf2597e0..ed67446261 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1435,12 +1435,6 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
\warning To make QMenu visible on the screen, exec() or popup() should be
used instead of show().
- \section1 QMenu on Qt for Windows CE
-
- If a menu is integrated into the native menubar on Windows Mobile we
- do not support the signals: aboutToHide (), aboutToShow () and hovered ().
- It is not possible to display an icon in a native menu on Windows Mobile.
-
\section1 QMenu on \macos with Qt Build Against Cocoa
QMenu can be inserted only once in a menu/menubar. Subsequent insertions will
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 68262bb8e4..99fddee53d 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -662,18 +662,6 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
the application's bundle. See \l{Qt for macOS - Deployment}
for more information.
- \section1 QMenuBar on Windows CE
-
- QMenuBar on Windows CE is a wrapper for using the system-wide menu bar,
- similar to the Mac. This feature is activated for Windows Mobile
- and integrates QMenuBar with the native soft keys. The left soft
- key can be controlled with QMenuBar::setDefaultAction() and the
- right soft key can be used to access the menu bar.
-
- The hovered() signal is not supported for the native menu
- integration. Also, it is not possible to display an icon in a
- native menu on Windows Mobile.
-
\section1 Examples
The \l{mainwindows/menus}{Menus} example shows how to use QMenuBar
@@ -1795,10 +1783,9 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const
\brief Whether or not a menubar will be used as a native menubar on platforms that support it
\since 4.6
- This property specifies whether or not the menubar should be used as a native menubar on platforms
- that support it. The currently supported platforms are \macos and Windows CE. On these platforms
- if this property is \c true, the menubar is used in the native menubar and is not in the window of
- its parent, if false the menubar remains in the window. On other platforms the value of this
+ This property specifies whether or not the menubar should be used as a native menubar on \macos.
+ If this property is \c true, the menubar is used in the native menubar and is not in the window of
+ its parent, if \c false the menubar remains in the window. On other platforms the value of this
attribute has no effect.
The default is to follow whether the Qt::AA_DontUseNativeMenuBar attribute