From 7291a244161ddf77308413b5abad9def68e4415a Mon Sep 17 00:00:00 2001
From: Marc Mutz
Date: Tue, 21 Feb 2017 09:10:47 +0100
Subject: QErrorMessage: use QStringBuilder
Extract Method msgType2i18nString() and use it to build 'rich' in a
single QStringBuilder expression.
Replace the switch over QtMsgType with an array of QT_TRANSLATE_NOOP'ed
strings. That introduces a dependency on the order and amount of enum
values, so add static and dynamic asserts to catch any change.
Saves memory allocations, as well as nearly 300B in text size on GCC 7
optimized Linux AMD64 builds.
Change-Id: I48cc916cba283e482a90ca4ae28aa17b26a4e5ab
Reviewed-by: David Faure
---
src/widgets/dialogs/qerrormessage.cpp | 45 +++++++++++++++++++----------------
1 file changed, 24 insertions(+), 21 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 8200135abe..4ec4da6e1a 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -161,32 +161,35 @@ static void deleteStaticcQErrorMessage() // post-routine
static bool metFatal = false;
+static QString msgType2i18nString(QtMsgType t)
+{
+ Q_STATIC_ASSERT(QtDebugMsg == 0);
+ Q_STATIC_ASSERT(QtWarningMsg == 1);
+ Q_STATIC_ASSERT(QtCriticalMsg == 2);
+ Q_STATIC_ASSERT(QtFatalMsg == 3);
+ Q_STATIC_ASSERT(QtInfoMsg == 4);
+
+ // adjust the array below if any of the above fire...
+
+ const char * const messages[] = {
+ QT_TRANSLATE_NOOP("QErrorMessage", "Debug Message:"),
+ QT_TRANSLATE_NOOP("QErrorMessage", "Warning:"),
+ QT_TRANSLATE_NOOP("QErrorMessage", "Critical Error:"),
+ QT_TRANSLATE_NOOP("QErrorMessage", "Fatal Error:"),
+ QT_TRANSLATE_NOOP("QErrorMessage", "Information:"),
+ };
+ Q_ASSERT(size_t(t) < sizeof messages / sizeof *messages);
+
+ return QCoreApplication::translate("QErrorMessage", messages[t]);
+}
+
static void jump(QtMsgType t, const QMessageLogContext & /*context*/, const QString &m)
{
if (!qtMessageHandler)
return;
- QString rich;
-
- switch (t) {
- case QtDebugMsg:
- rich = QErrorMessage::tr("Debug Message:");
- break;
- case QtWarningMsg:
- rich = QErrorMessage::tr("Warning:");
- break;
- case QtCriticalMsg:
- rich = QErrorMessage::tr("Critical Error:");
- break;
- case QtFatalMsg:
- rich = QErrorMessage::tr("Fatal Error:");
- break;
- case QtInfoMsg:
- rich = QErrorMessage::tr("Information:");
- break;
- }
- rich = QString::fromLatin1("%1
").arg(rich);
- rich += Qt::convertFromPlainText(m, Qt::WhiteSpaceNormal);
+ QString rich = QLatin1String("") + msgType2i18nString(t) + QLatin1String("
")
+ + Qt::convertFromPlainText(m, Qt::WhiteSpaceNormal);
// ### work around text engine quirk
if (rich.endsWith(QLatin1String("
")))
--
cgit v1.2.3
From 903a59042e4017d851d8b32f2f8568fd36aeb2c8 Mon Sep 17 00:00:00 2001
From: Joni Poikelin
Date: Tue, 24 Jan 2017 20:12:04 +0200
Subject: Fix QComboBox popup from opening on wrong screen
Nothing seems to be telling the popup on which screen it should be shown
on. To fix this, simply set same screen the QComboBox uses to the popup.
Task-number: QTBUG-58392
Change-Id: If62a26fe4e51bcf3d770ee72c9baa998541618f4
Reviewed-by: Andy Shaw
---
src/widgets/widgets/qcombobox.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
(limited to 'src/widgets')
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index b18066c174..2376a18e43 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2746,6 +2746,22 @@ void QComboBox::showPopup()
bool startTimer = !container->isVisible();
container->raise();
+ container->create();
+ QWindow *containerWindow = container->window()->windowHandle();
+ if (containerWindow) {
+ QWindow *win = window()->windowHandle();
+ if (win) {
+ QScreen *currentScreen = win->screen();
+ if (currentScreen && !currentScreen->virtualSiblings().contains(containerWindow->screen())) {
+ containerWindow->setScreen(currentScreen);
+
+ // This seems to workaround an issue in xcb+multi GPU+multiscreen
+ // environment where the window might not always show up when screen
+ // is changed.
+ container->hide();
+ }
+ }
+ }
container->show();
container->updateScrollers();
view()->setFocus();
--
cgit v1.2.3
From 38bedf34c9190e3ab7d662eed39a1248698095d8 Mon Sep 17 00:00:00 2001
From: Stephan Binner
Date: Thu, 20 Apr 2017 20:12:20 +0200
Subject: Remove wrong features.rubberband condition of features.dockwidget
Change-Id: I8259274e7eba7943eb3a944a18fa8b598eb697d7
Reviewed-by: Lars Knoll
---
src/widgets/configure.json | 2 +-
src/widgets/widgets/qdockwidget.cpp | 1 -
src/widgets/widgets/qdockwidget_p.h | 1 -
3 files changed, 1 insertion(+), 3 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index ab8ced3849..ec3dedca6a 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -304,7 +304,7 @@
"label": "QDockwidget",
"purpose": "Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop.",
"section": "Widgets",
- "condition": "features.rubberband && features.mainwindow",
+ "condition": "features.mainwindow",
"output": [ "publicFeature", "feature" ]
},
"mdiarea": {
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 307a261a43..6d9731e962 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -49,7 +49,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h
index 84bf8efacf..2d62cf5acd 100644
--- a/src/widgets/widgets/qdockwidget_p.h
+++ b/src/widgets/widgets/qdockwidget_p.h
@@ -63,7 +63,6 @@ QT_BEGIN_NAMESPACE
class QGridLayout;
class QWidgetResizeHandler;
-class QRubberBand;
class QDockWidgetTitleButton;
class QSpacerItem;
class QDockWidgetItem;
--
cgit v1.2.3
From 72b3fa702ab9ea7cc2252ef33a72a791aa032058 Mon Sep 17 00:00:00 2001
From: Stephan Binner
Date: Thu, 20 Apr 2017 19:50:15 +0200
Subject: Remove features.rubberband dependency of features.splitter
Change-Id: Ia55850f37f9384c8e00cef699fa308a02af64fd5
Reviewed-by: Lars Knoll
---
src/widgets/configure.json | 1 -
src/widgets/widgets/qsplitter.cpp | 6 ++++++
src/widgets/widgets/qsplitter_p.h | 8 +++++++-
3 files changed, 13 insertions(+), 2 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index ec3dedca6a..f84feb5761 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -160,7 +160,6 @@
"label": "QSplitter",
"purpose": "Provides user controlled splitter widgets.",
"section": "Widgets",
- "condition": "features.rubberband",
"output": [ "publicFeature", "feature" ]
},
"widgettextcontrol": {
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 1676c188a6..4c077f5f9f 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -975,7 +975,9 @@ QSplitter::QSplitter(Qt::Orientation orientation, QWidget *parent)
QSplitter::~QSplitter()
{
Q_D(QSplitter);
+#if QT_CONFIG(rubberband)
delete d->rubberBand;
+#endif
while (!d->list.isEmpty())
delete d->list.takeFirst();
}
@@ -1325,6 +1327,7 @@ void QSplitter::childEvent(QChildEvent *c)
void QSplitter::setRubberBand(int pos)
{
+#if QT_CONFIG(rubberband)
Q_D(QSplitter);
if (pos < 0) {
if (d->rubberBand)
@@ -1345,6 +1348,9 @@ void QSplitter::setRubberBand(int pos)
: QRect(QPoint(r.x(), pos + hw / 2 - rBord), QSize(r.width(), 2 * rBord));
d->rubberBand->setGeometry(newGeom);
d->rubberBand->show();
+#else
+ Q_UNUSED(pos);
+#endif
}
/*!
diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h
index 07b43e56b8..0730fab824 100644
--- a/src/widgets/widgets/qsplitter_p.h
+++ b/src/widgets/widgets/qsplitter_p.h
@@ -81,11 +81,17 @@ class QSplitterPrivate : public QFramePrivate
{
Q_DECLARE_PUBLIC(QSplitter)
public:
- QSplitterPrivate() : rubberBand(0), opaque(true), firstShow(true),
+ QSplitterPrivate() :
+#if QT_CONFIG(rubberband)
+ rubberBand(0),
+#endif
+ opaque(true), firstShow(true),
childrenCollapsible(true), compatMode(false), handleWidth(-1), blockChildAdd(false), opaqueResizeSet(false) {}
~QSplitterPrivate();
+#if QT_CONFIG(rubberband)
QPointer rubberBand;
+#endif
mutable QList list;
Qt::Orientation orient;
bool opaque : 8;
--
cgit v1.2.3
From 45104dff04f938cc5d40698fca518b317b53083e Mon Sep 17 00:00:00 2001
From: Stephan Binner
Date: Thu, 20 Apr 2017 21:57:17 +0200
Subject: Remove wrong features.rubberband condition of features.itemviews
Change-Id: I0eff127baba2f8677ae08bb18ef0b4bb742d7b6e
Reviewed-by: Lars Knoll
---
src/widgets/configure.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/widgets')
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index f84feb5761..f0fce9b52b 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -93,7 +93,7 @@
"label": "The Model/View Framework",
"purpose": "Provides the model/view architecture managing the relationship between data and the way it is presented to the user.",
"section": "ItemViews",
- "condition": "features.itemmodel && features.rubberband && features.scrollarea",
+ "condition": "features.itemmodel && features.scrollarea",
"output": [ "publicFeature", "feature" ]
},
"treewidget": {
--
cgit v1.2.3
From 5cde07350c99d68c9d1f3d92e0a5057e2bcba0db Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich
Date: Tue, 18 Apr 2017 10:41:48 -0700
Subject: QMacStyle: Properly flip vertical sliders
Cocoa is better than us at vertically flipping views,
so we use that API instead of fiddling with the graphics
context transforms. But only so from 10.12 onwards. Go
figure.
This also fixes a one pixel offset with horizontal sliders
handle on non-retina displays.
Change-Id: Ia3da8431ad0499a4b6fb7bf6973ed353d91c2905
Task-number: QTBUG-59666
Reviewed-by: Jake Petroules
---
src/widgets/styles/qmacstyle_mac.mm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index a9aab10e0f..a3b394a291 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -5564,16 +5564,18 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
sl.intValue = slider->sliderValue;
sl.enabled = slider->state & QStyle::State_Enabled;
d->drawNSViewInRect(cw, sl, opt->rect, p, widget != 0, ^(NSRect rect, CGContextRef ctx) {
+ const bool isSierraOrLater = QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSSierra;
if (slider->upsideDown) {
if (isHorizontal) {
CGContextTranslateCTM(ctx, rect.size.width, 0);
CGContextScaleCTM(ctx, -1, 1);
}
- } else if (!isHorizontal) {
+ } else if (!isHorizontal && !isSierraOrLater) {
CGContextTranslateCTM(ctx, 0, rect.size.height);
CGContextScaleCTM(ctx, 1, -1);
}
- [sl.cell drawBarInside:NSRectFromCGRect(tdi.bounds) flipped:NO];
+ const bool shouldFlip = isHorizontal || (slider->upsideDown && isSierraOrLater);
+ [sl.cell drawBarInside:NSRectFromCGRect(tdi.bounds) flipped:shouldFlip];
// No need to restore the CTM later, the context has been saved
// and will be restored at the end of drawNSViewInRect()
});
--
cgit v1.2.3
From b1131074199aae97b2a005cba871f6baf2a32c63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?=
Date: Mon, 10 Apr 2017 11:17:51 +0200
Subject: QMacStyle: Fix scroller memory leak
Calling initWithFrame repeatedly on the same object
leaks memory since internal structures allocated on
the previous init call will not be released.
However, initWithFrame is the only API that can set
scroller direction, which is does based on the geometry.
Use two scroller objets, one for each of the horizontal
and vertical cases.
Task-number: QTBUG-60004
Change-Id: I5d07b62e6969a1824ab705941ac4d0340139b99c
Reviewed-by: Timur Pocheptsov
Reviewed-by: Gabriel de Dietrich
---
src/widgets/styles/qmacstyle_mac.mm | 13 +++++++++----
src/widgets/styles/qmacstyle_mac_p_p.h | 6 +++++-
2 files changed, 14 insertions(+), 5 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index a3b394a291..0bd2894402 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -2110,7 +2110,12 @@ QMacStyle::QMacStyle()
name:NSPreferredScrollerStyleDidChangeNotification
object:nil];
- d->nsscroller = [[NSScroller alloc] init];
+ // Create scroller objects. Scroller internal direction setup happens
+ // on initWithFrame and cannot be changed later on. Create two scrollers
+ // initialized with fake geometry. Correct geometry is set at draw time.
+ d->horizontalScroller = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)];
+ d->verticalScroller = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 20, 200)];
+
d->indicatorBranchButtonCell = nil;
}
@@ -2119,7 +2124,8 @@ QMacStyle::~QMacStyle()
Q_D(QMacStyle);
QMacAutoReleasePool pool;
- [reinterpret_cast(d->nsscroller) release];
+ [d->horizontalScroller release];
+ [d->verticalScroller release];
NotificationReceiver *receiver = static_cast(d->receiver);
[[NSNotificationCenter defaultCenter] removeObserver:receiver];
@@ -5451,8 +5457,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
[NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]];
- NSScroller *scroller = reinterpret_cast(d->nsscroller);
- [scroller initWithFrame:NSMakeRect(0, 0, slider->rect.width(), slider->rect.height())];
+ NSScroller *scroller = isHorizontal ? d->horizontalScroller : d-> verticalScroller;
// mac os behaviour: as soon as one color channel is >= 128,
// the bg is considered bright, scroller is dark
const QColor bgColor = QStyleHelper::backgroundColor(opt->palette, widget);
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 9bbd0995a5..e5d2ffdc9d 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -115,6 +115,9 @@
// We mean it.
//
+Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSScroller);
+
QT_BEGIN_NAMESPACE
/*
@@ -246,7 +249,8 @@ public:
CFAbsoluteTime defaultButtonStart;
bool mouseDown;
void* receiver;
- void *nsscroller;
+ NSScroller *horizontalScroller;
+ NSScroller *verticalScroller;
void *indicatorBranchButtonCell;
NSView *backingStoreNSView;
QHash cocoaControls;
--
cgit v1.2.3
From 41eefd7493bf0119a4fd1a069e31ab4f2c4d10f9 Mon Sep 17 00:00:00 2001
From: Gatis Paeglis
Date: Thu, 20 Apr 2017 16:07:06 +0200
Subject: Deprecate QCoreApplication::flush()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
... as it has outlived its original purpose:
Qt3 implementation on X11:
void QApplication::flush() { flushX(); }
void QApplication::flushX() { if (appDpy) XFlush( appDpy ); }
Qt4 implementation on X11:
Did nothing when QApplication::flush() was called (the flush()
overrides in {unix,glib} event dispatchers with empty bodies).
In Qt5 this function somehow has been repurposed (inconsistently)
to do what QCoreApplication::sendPostedEvents already does:
QAbstractEventDispatcher::flush() = 0;
=> QCocoaEventDispatcher::flush() {}
=> QEventDispatcherCoreFoundation::flush() {}
=> QIOSEventDispatcher (does not override ::flush())
=> QEventDispatcherGlib::flush() {}
=> QPAEventDispatcherGlib (does not override ::flush())
=> QEventDispatcherUNIX::flush() {}
=> QUnixEventDispatcherQPA (when QT_NO_GLIB=true)
::flush() { if (qApp) qApp->sendPostedEvents(); })
==> QAndroidEventDispatcher (does not override ::flush())
=> QEventDispatcherWin32::flush() {}
=> QOffscreenEventDispatcher::flush() {
if (qApp) qApp->sendPostedEvents();
QEventDispatcherWin32::flush();
}
=> QWindowsGuiEventDispatcher (does not override ::flush())
=> QWindowsDirect2DEventDispatcher (does not override ::flush())
=> QEventDispatcherWinRT::flush() {}
=> QOffscreenEventDispatcher::flush() {
if (qApp) qApp->sendPostedEvents();
QEventDispatcherWinRT::flush();
}
=> QWinRTEventDispatcher (qminimaleglintegration.cpp) (does not override ::flush())
=> QWinRTEventDispatcher (qwinrteventdispatcher.h) (does not override ::flush())
Whatever this function was doing on macOS in Qt3 and Qt4 also has been
dropped in Qt5. It appears that the other event dispatchers in Qt5 that
have overrides for flush() have simply copy-pasted this logic.
Clearly the documentation of QCoreApplication::flush() is outdated and
has nothing to do with the actual implementation in Qt5.
This function is rarely used in Qt5 sources. It should be safe to remove
the calls to QCoreApplication::flush() from Qt source code, as this
function has been doing nothing on most platforms anyways. Repurposing
it even broke handling of posted events (see QTBUG-48717).
[ChangeLog][QtCore][Event loop] QCoreApplication::flush() is now
deprecated. Use QCoreApplication::processEvents() and
QCoreApplication::sendPostedEvents() instead.
Task-number: QTBUG-33489
Task-number: QTBUG-48717
Change-Id: Icc7347ff203024b7153ea74be6bf527dd07ce821
Reviewed-by: Tor Arne Vestbø
Reviewed-by: David Faure
Reviewed-by: Gunnar Sletta
---
src/widgets/widgets/qabstractbutton.cpp | 18 ++++++------------
src/widgets/widgets/qsplashscreen.cpp | 19 +++++++------------
2 files changed, 13 insertions(+), 24 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index c0bd8bce5a..77fb203b82 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -396,8 +396,7 @@ void QAbstractButtonPrivate::click()
}
blockRefresh = false;
refresh();
- q->repaint(); //flush paint event before invoking potentially expensive operation
- QApplication::flush();
+ q->repaint();
if (guard)
emitReleased();
if (guard)
@@ -834,8 +833,7 @@ void QAbstractButton::animateClick(int msec)
if (d->checkable && focusPolicy() & Qt::ClickFocus)
setFocus();
setDown(true);
- repaint(); //flush paint event before invoking potentially expensive operation
- QApplication::flush();
+ repaint();
if (!d->animateTimer.isActive())
d->emitPressed();
d->animateTimer.start(msec, this);
@@ -977,8 +975,7 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e)
if (hitButton(e->pos())) {
setDown(true);
d->pressed = true;
- repaint(); //flush paint event before invoking potentially expensive operation
- QApplication::flush();
+ repaint();
d->emitPressed();
e->accept();
} else {
@@ -1025,8 +1022,7 @@ void QAbstractButton::mouseMoveEvent(QMouseEvent *e)
if (hitButton(e->pos()) != d->down) {
setDown(!d->down);
- repaint(); //flush paint event before invoking potentially expensive operation
- QApplication::flush();
+ repaint();
if (d->down)
d->emitPressed();
else
@@ -1051,8 +1047,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
case Qt::Key_Space:
if (!e->isAutoRepeat()) {
setDown(true);
- repaint(); //flush paint event before invoking potentially expensive operation
- QApplication::flush();
+ repaint();
d->emitPressed();
}
break;
@@ -1103,8 +1098,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
#ifndef QT_NO_SHORTCUT
if (e->matches(QKeySequence::Cancel) && d->down) {
setDown(false);
- repaint(); //flush paint event before invoking potentially expensive operation
- QApplication::flush();
+ repaint();
d->emitReleased();
return;
}
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index 4ad2b83582..2758af53ef 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -164,15 +164,14 @@ void QSplashScreen::mousePressEvent(QMouseEvent *)
}
/*!
- This overrides QWidget::repaint(). It differs from the standard
- repaint function in that it also calls QApplication::flush() to
- ensure the updates are displayed, even when there is no event loop
- present.
+ This overrides QWidget::repaint(). It differs from the standard repaint
+ function in that it also calls QApplication::processEvents() to ensure
+ the updates are displayed, even when there is no event loop present.
*/
void QSplashScreen::repaint()
{
QWidget::repaint();
- QApplication::flush();
+ QApplication::processEvents();
}
/*!
@@ -190,13 +189,9 @@ void QSplashScreen::repaint()
/*!
Draws the \a message text onto the splash screen with color \a
color and aligns the text according to the flags in \a alignment.
-
- To make sure the splash screen is repainted immediately, you can
- call \l{QCoreApplication}'s
- \l{QCoreApplication::}{processEvents()} after the call to
- showMessage(). You usually want this to make sure that the message
- is kept up to date with what your application is doing (e.g.,
- loading files).
+ This function calls repaint() to make sure the splash screen is
+ repainted immediately. As a result the message is kept up
+ to date with what your application is doing (e.g. loading files).
\sa Qt::Alignment, clearMessage(), message()
*/
--
cgit v1.2.3
From 2eee24702b8f3a83e8fdd810fa22f2fe65ee848b Mon Sep 17 00:00:00 2001
From: Olivier Goffart
Date: Wed, 19 Apr 2017 11:16:14 +0200
Subject: Fix UB in QSplitter::childEvent
The widget might be in the QObject destructor when the event is received,
so we can't static cast.
There is no need to check for isWindow for ChildRemoved because it would
not otherwise be on our list.
Change-Id: Ifc0a2979f1f6720f1963399276a28ac4a3224fff
Reviewed-by: Marc Mutz
Reviewed-by: Giuseppe D'Angelo
---
src/widgets/widgets/qsplitter.cpp | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 4c077f5f9f..0c98c3875a 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -1298,18 +1298,19 @@ void QSplitter::childEvent(QChildEvent *c)
qWarning("Adding a QLayout to a QSplitter is not supported.");
return;
}
- QWidget *w = static_cast(c->child());
- if (w->isWindow())
- return;
- if (c->added() && !d->blockChildAdd && !d->findWidget(w)) {
- d->insertWidget_helper(d->list.count(), w, false);
- } else if (c->polished() && !d->blockChildAdd) {
- if (d->shouldShowWidget(w))
+ if (c->added()) {
+ QWidget *w = static_cast(c->child());
+ if (!d->blockChildAdd && !w->isWindow() && !d->findWidget(w))
+ d->insertWidget_helper(d->list.count(), w, false);
+ } else if (c->polished()) {
+ QWidget *w = static_cast(c->child());
+ if (!d->blockChildAdd && !w->isWindow() && d->shouldShowWidget(w))
w->show();
- } else if (c->type() == QEvent::ChildRemoved) {
+ } else if (c->removed()) {
+ QObject *child = c->child();
for (int i = 0; i < d->list.size(); ++i) {
QSplitterLayoutStruct *s = d->list.at(i);
- if (s->widget == w) {
+ if (s->widget == child) {
d->list.removeAt(i);
delete s;
d->recalc(isVisible());
--
cgit v1.2.3
From 21db5ebea9be179d325f43b5b3ca8eb5ebdae771 Mon Sep 17 00:00:00 2001
From: Stephan Binner
Date: Thu, 20 Apr 2017 14:23:17 +0200
Subject: Fix warnings for -no-feature-animation
Change-Id: I624e68e96d2a673b36d9519d1189fe4a25e1fbd0
Reviewed-by: Paul Olav Tvete
---
src/widgets/styles/qfusionstyle.cpp | 10 ++++++----
src/widgets/styles/qstylesheetstyle.cpp | 2 ++
2 files changed, 8 insertions(+), 4 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 123aa351cd..dc703e3e8d 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -2441,9 +2441,11 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
qreal expandOffset = -1.0;
QObject *styleObject = option->styleObject;
if (styleObject && proxy()->styleHint(SH_ScrollBar_Transient, option, widget)) {
+#if QT_CONFIG(animation)
qreal opacity = 0.0;
bool shouldExpand = false;
const qreal maxExpandScale = 13.0 / 9.0;
+#endif
int oldPos = styleObject->property("_q_stylepos").toInt();
int oldMin = styleObject->property("_q_stylemin").toInt();
@@ -2464,10 +2466,6 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
oldState != scrollBar->state ||
oldActiveControls != scrollBar->activeSubControls) {
- // if the scrollbar is transient or its attributes, geometry or
- // state has changed, the opacity is reset back to 100% opaque
- opacity = 1.0;
-
styleObject->setProperty("_q_stylepos", scrollBar->sliderPosition);
styleObject->setProperty("_q_stylemin", scrollBar->minimum);
styleObject->setProperty("_q_stylemax", scrollBar->maximum);
@@ -2476,6 +2474,10 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
styleObject->setProperty("_q_stylecontrols", static_cast(scrollBar->activeSubControls));
#ifndef QT_NO_ANIMATION
+ // if the scrollbar is transient or its attributes, geometry or
+ // state has changed, the opacity is reset back to 100% opaque
+ opacity = 1.0;
+
QScrollbarStyleAnimation *anim = qobject_cast(d->animation(styleObject));
if (transient) {
if (!anim) {
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 48068adac9..5d977d75c0 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3914,7 +3914,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
}
QRect r = rect;
+#if QT_CONFIG(animation)
Q_D(const QWindowsStyle);
+#endif
if (pb->minimum == 0 && pb->maximum == 0) {
int chunkCount = fillWidth/chunkWidth;
int offset = 0;
--
cgit v1.2.3
From 445191bba8216276e6200157906ca9d138d7be04 Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich
Date: Tue, 25 Apr 2017 16:54:29 -0700
Subject: QMenu: Display the menu title on the torn-off menu's title bar
Change-Id: If16e262a6c8b39dff517cc105cf55686d4c22582
Task-number: QTBUG-11693
Reviewed-by: Shawn Rutledge
---
src/widgets/widgets/qmenu.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
(limited to 'src/widgets')
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 98dc6d0a11..d62c010c60 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -72,6 +72,7 @@
#include
#include
#include
+#include
QT_BEGIN_NAMESPACE
@@ -127,7 +128,7 @@ public:
setParent(parentWidget, Qt::Window | Qt::Tool);
setAttribute(Qt::WA_DeleteOnClose, true);
setAttribute(Qt::WA_X11NetWmWindowTypeMenu, true);
- setWindowTitle(p->windowTitle());
+ updateWindowTitle();
setEnabled(p->isEnabled());
#if QT_CONFIG(cssparser)
setStyleSheet(p->styleSheet());
@@ -165,6 +166,15 @@ public:
}
}
+ void updateWindowTitle()
+ {
+ Q_D(QTornOffMenu);
+ if (!d->causedMenu)
+ return;
+ const QString &cleanTitle = QPlatformTheme::removeMnemonics(d->causedMenu->title()).trimmed();
+ setWindowTitle(cleanTitle);
+ }
+
public slots:
void onTrigger(QAction *action) { d_func()->activateAction(action, QAction::Trigger, false); }
void onHovered(QAction *action) { d_func()->activateAction(action, QAction::Hover, false); }
@@ -183,6 +193,10 @@ void QMenuPrivate::init()
q->setAttribute(Qt::WA_X11NetWmWindowTypePopupMenu);
defaultMenuAction = menuAction = new QAction(q);
menuAction->d_func()->menu = q;
+ QObject::connect(menuAction, &QAction::changed, [=] {
+ if (!tornPopup.isNull())
+ tornPopup->updateWindowTitle();
+ });
q->setMouseTracking(q->style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, q));
if (q->style()->styleHint(QStyle::SH_Menu_Scrollable, 0, q)) {
scroll = new QMenuPrivate::QMenuScroller;
--
cgit v1.2.3
From 32f8cbae90d7d5f5a23a645b39a2f1a29d378af8 Mon Sep 17 00:00:00 2001
From: Dyami Caliri
Date: Tue, 15 Nov 2016 14:45:29 -0800
Subject: QOpenGLWidget: Fix UB (invalid cast) in ~QOpenGLWidgetPrivate
The QOpenGLWidgetPrivate destructor calls reset(), which accesses
the Q-pointer. Calling Q_Q(Class) while still inside the private
class's destructor is wrong due to the cast in q_func() which is
undefined behavior at that stage.
Here is the UB report:
qopenglwidget.cpp:548:5: runtime error: downcast of address 0x000016d0e200 which does not point to an object of type 'QOpenGLWidget'
0x000016d0e200: note: object is of type 'QObject'
00 00 00 00 10 30 32 0f 00 00 00 00 40 e2 d0 16 00 00 00 00 80 7b 42 0f 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QObject'
0 QOpenGLWidgetPrivate::reset qopenglwidget.cpp 656 0x607e667
1 QOpenGLWidgetPrivate::~QOpenGLWidgetPrivate qopenglwidget.cpp 570 0x60982ab
2 QOpenGLWidgetPrivate::~QOpenGLWidgetPrivate qopenglwidget.cpp 569 0x6098516
3 QScopedPointerDeleter::cleanup qscopedpointer.h 54 0xcbf7058
4 QScopedPointer>::~QScopedPointer qscopedpointer.h 101 0xcbde858
5 QObject::~QObject qobject.cpp 1042 0xcb94792
6 QWidget::~QWidget qwidget.cpp 1701 0x5e173f7
7 QOpenGLWidget::~QOpenGLWidget qopenglwidget.cpp 946 0x608d72b
8 ImagePreviewComponent::~ImagePreviewComponent imagepreviewcomponent.h 16 0x58237b6
9 ImagePreviewComponent::~ImagePreviewComponent imagepreviewcomponent.h 16 0x58238c6
Change-Id: If13932ac657afb9d1358ac82ab911a05e96cfbcd
Reviewed-by: Laszlo Agocs
---
src/widgets/kernel/qopenglwidget.cpp | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 23948892f0..9aab0bd76a 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -572,11 +572,6 @@ public:
requestedFormat = QSurfaceFormat::defaultFormat();
}
- ~QOpenGLWidgetPrivate()
- {
- reset();
- }
-
void reset();
void recreateFbo();
@@ -962,7 +957,8 @@ QOpenGLWidget::QOpenGLWidget(QWidget *parent, Qt::WindowFlags f)
*/
QOpenGLWidget::~QOpenGLWidget()
{
- makeCurrent();
+ Q_D(QOpenGLWidget);
+ d->reset();
}
/*!
--
cgit v1.2.3
From a9e0879ee16932d8155850b52162ee5429164982 Mon Sep 17 00:00:00 2001
From: Tasuku Suzuki
Date: Tue, 25 Apr 2017 15:36:48 +0900
Subject: Fix build without features.shortcut
Change-Id: I87a7ba1a77b0671559616a3ea4722bcc233af32d
Reviewed-by: Oswald Buddenhagen
Reviewed-by: Paul Olav Tvete
---
src/widgets/accessible/qaccessiblewidget.cpp | 2 ++
src/widgets/dialogs/qfiledialog.cpp | 4 +++-
src/widgets/dialogs/qmessagebox.cpp | 2 +-
src/widgets/widgets/qwidgetlinecontrol.cpp | 2 ++
4 files changed, 8 insertions(+), 2 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index 94cf58ae3b..d5f7449e57 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -148,6 +148,8 @@ QString qt_accHotKey(const QString &text)
int ampIndex = qt_accAmpIndex(text);
if (ampIndex != -1)
return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1);
+#else
+ Q_UNUSED(text)
#endif
return QString();
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 78e304950a..98f8147236 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -3812,8 +3812,8 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory)
*/
bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
- Q_Q(QFileDialog);
#if QT_CONFIG(shortcut)
+ Q_Q(QFileDialog);
if (event->matches(QKeySequence::Cancel)) {
q->reject();
return true;
@@ -4018,7 +4018,9 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
}
#endif // QT_KEYPAD_NAVIGATION
+#if QT_CONFIG(shortcut)
int key = e->key();
+#endif
QLineEdit::keyPressEvent(e);
#if QT_CONFIG(shortcut)
if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back)
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index fe32611ed8..7a98fae99c 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1404,8 +1404,8 @@ void QMessageBox::changeEvent(QEvent *ev)
*/
void QMessageBox::keyPressEvent(QKeyEvent *e)
{
- Q_D(QMessageBox);
#if QT_CONFIG(shortcut)
+ Q_D(QMessageBox);
if (e->matches(QKeySequence::Cancel)) {
if (d->detectedEscapeButton) {
#ifdef Q_OS_MAC
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 363e7157ac..905bc0f586 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -1704,7 +1704,9 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
}
bool unknown = false;
+#if QT_CONFIG(shortcut)
bool visual = cursorMoveStyle() == Qt::VisualMoveStyle;
+#endif
if (false) {
}
--
cgit v1.2.3
From 9b8a7de7946c6fa32d72fef37aa18a59054208d7 Mon Sep 17 00:00:00 2001
From: Tasuku Suzuki
Date: Wed, 26 Apr 2017 10:03:52 +0900
Subject: Fix build without features.style-stylesheet
Change-Id: Ib7cf5db6c9a49e7f359410bc0ec3d1ceadcde5cf
Reviewed-by: Stephan Binner
Reviewed-by: Paul Olav Tvete
---
src/widgets/widgets/qmenu.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/widgets')
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index d62c010c60..4a3291b2ca 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -130,7 +130,7 @@ public:
setAttribute(Qt::WA_X11NetWmWindowTypeMenu, true);
updateWindowTitle();
setEnabled(p->isEnabled());
-#if QT_CONFIG(cssparser)
+#if QT_CONFIG(style_stylesheet)
setStyleSheet(p->styleSheet());
#endif
if (style() != p->style())
--
cgit v1.2.3
From de76ccb9673eb7dda1c8a66fe4a063b00f36eb59 Mon Sep 17 00:00:00 2001
From: Tasuku Suzuki
Date: Thu, 27 Apr 2017 12:43:36 +0900
Subject: Fix warnings with -no-feature-menu
Change-Id: I1e62e3772dbd5f17d9ad69025b23e3726386c2bd
Reviewed-by: Oswald Buddenhagen
Reviewed-by: Stephan Binner
Reviewed-by: Lars Knoll
---
src/widgets/accessible/simplewidgets.cpp | 5 +++--
src/widgets/util/qsystemtrayicon.cpp | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index a53e5eaf30..aa075cad1b 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -327,9 +327,8 @@ int QAccessibleToolButton::childCount() const
QAccessible::Role QAccessibleToolButton::role() const
{
- QAbstractButton *ab = button();
-
#ifndef QT_NO_MENU
+ QAbstractButton *ab = button();
QToolButton *tb = qobject_cast(ab);
if (!tb->menu())
return tb->isCheckable() ? QAccessible::CheckBox : QAccessible::PushButton;
@@ -347,6 +346,8 @@ QAccessibleInterface *QAccessibleToolButton::child(int index) const
{
return QAccessible::queryAccessibleInterface(toolButton()->menu());
}
+#else
+ Q_UNUSED(index)
#endif
return 0;
}
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 1e0d2ab857..11214d93eb 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -738,6 +738,8 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const
QPlatformMenu *platformMenu = qpa_sys->createMenu();
if (platformMenu)
menu->setPlatformMenu(platformMenu);
+#else
+ Q_UNUSED(menu)
#endif // QT_CONFIG(menu)
}
--
cgit v1.2.3
From ea15b170ef666692cfb0e04e45e536da8d1a7a50 Mon Sep 17 00:00:00 2001
From: Tasuku Suzuki
Date: Thu, 27 Apr 2017 12:23:05 +0900
Subject: Fix warning for -no-feature-lineedit
Change-Id: Ia56d5d7266a379f911e4db61e60b8b39af5b6342
Reviewed-by: Stephan Binner
Reviewed-by: Oswald Buddenhagen
Reviewed-by: Lars Knoll
---
src/widgets/itemviews/qabstractitemdelegate.cpp | 2 ++
1 file changed, 2 insertions(+)
(limited to 'src/widgets')
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index f63e258e8e..f7c170f0bb 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -547,6 +547,8 @@ bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor)
return e->hasAcceptableInput();
}
}
+#else
+ Q_UNUSED(editor)
#endif // QT_NO_LINEEDIT
return true;
--
cgit v1.2.3
From 68df0576dda6bffebdea6bb5e4067ff8e3b21cd0 Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich
Date: Fri, 28 Apr 2017 14:51:36 -0700
Subject: QMacStyle: Increase accuracy of PM_TitleBarHeight
In some cases, we'd want such value to come from the
platform theme, but we'd need new API for this.
Change-Id: Ic7053fa17ac8b2f207db031095c4e4aefae000c2
Reviewed-by: Jake Petroules
---
src/widgets/styles/qmacstyle_mac.mm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 0bd2894402..0ffcf9b0d5 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -2470,11 +2470,13 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case PM_ButtonDefaultIndicator:
ret = 0;
break;
- case PM_TitleBarHeight:
- // Always use NSTitledWindowMask since we never need any other type of window here
+ case PM_TitleBarHeight: {
+ NSUInteger style = NSTitledWindowMask;
+ if (widget && ((widget->windowFlags() & Qt::Tool) == Qt::Tool))
+ style |= NSUtilityWindowMask;
ret = int([NSWindow frameRectForContentRect:NSZeroRect
- styleMask:NSTitledWindowMask].size.height);
- break;
+ styleMask:style].size.height);
+ break; }
case QStyle::PM_TabBarTabHSpace:
switch (d->aquaSizeConstrain(opt, widget)) {
case QAquaSizeLarge:
--
cgit v1.2.3
From 7eae7e8103c79c9e098fc112bb8157971117678d Mon Sep 17 00:00:00 2001
From: Andy Shaw
Date: Fri, 28 Apr 2017 22:19:15 +0200
Subject: macOS: Fix return value of PM_TabBarBaseHeight to original value
When the tabbar styling was improved in change
175f33ed855b0a8a30daafacd4f48fa3f8e76a9b it changed
PM_TabBarBaseHeight to 21 which is incorrect as this value represents
the spacing between the tab pages and the tabbar. In macOS style
there is no space so this should be set to 0.
Task-number: QTBUG-60307
Change-Id: I2ce39ff2fc924d2d83843fab78b311153b4ee08f
Reviewed-by: Oleg Yadrov
Reviewed-by: Gabriel de Dietrich
---
src/widgets/styles/qmacstyle_mac.mm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/widgets')
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 0ffcf9b0d5..8d0fe1196c 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -2505,7 +2505,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
ret = 0;
break;
case PM_TabBarBaseHeight:
- ret = 21;
+ ret = 0;
break;
case PM_TabBarTabOverlap:
ret = 1;
--
cgit v1.2.3
From d9e55e40a9c0546981981fe2340a52fbb1b47b04 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint
Date: Fri, 28 Apr 2017 12:31:07 +0200
Subject: QFileDialogPrivate: Move inline to declaration
Fixes MSVC warning:
src/widgets/dialogs/qfiledialog_p.h(412): warning C4273: 'QFileDialogPrivate::selectedMimeTypeFilter_sys': inconsistent dll linkage
while building tst_qfiledialog2.
Amends change 34f82b8abcb279542b6350e70609c549e39caafb.
Change-Id: I7306535000af73ee3a027b14a2d5cfce4f889e85
Reviewed-by: Marc Mutz
---
src/widgets/dialogs/qfiledialog_p.h | 41 +++++++++++++++++++------------------
1 file changed, 21 insertions(+), 20 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index b665b54a9b..d5df7542b6 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -253,15 +253,15 @@ public:
bool canBeNativeDialog() const Q_DECL_OVERRIDE;
inline bool usingWidgets() const;
- void setDirectory_sys(const QUrl &directory);
- QUrl directory_sys() const;
- void selectFile_sys(const QUrl &filename);
- QList selectedFiles_sys() const;
- void setFilter_sys();
- void selectMimeTypeFilter_sys(const QString &filter);
- QString selectedMimeTypeFilter_sys() const;
- void selectNameFilter_sys(const QString &filter);
- QString selectedNameFilter_sys() const;
+ inline void setDirectory_sys(const QUrl &directory);
+ inline QUrl directory_sys() const;
+ inline void selectFile_sys(const QUrl &filename);
+ inline QList selectedFiles_sys() const;
+ inline void setFilter_sys();
+ inline void selectMimeTypeFilter_sys(const QString &filter);
+ inline QString selectedMimeTypeFilter_sys() const;
+ inline void selectNameFilter_sys(const QString &filter);
+ inline QString selectedNameFilter_sys() const;
//////////////////////////////////////////////
QScopedPointer qFileDialogUi;
@@ -341,14 +341,14 @@ private:
QFileDialogPrivate *d_ptr;
};
-inline QModelIndex QFileDialogPrivate::mapToSource(const QModelIndex &index) const {
+QModelIndex QFileDialogPrivate::mapToSource(const QModelIndex &index) const {
#ifdef QT_NO_PROXYMODEL
return index;
#else
return proxyModel ? proxyModel->mapToSource(index) : index;
#endif
}
-inline QModelIndex QFileDialogPrivate::mapFromSource(const QModelIndex &index) const {
+QModelIndex QFileDialogPrivate::mapFromSource(const QModelIndex &index) const {
#ifdef QT_NO_PROXYMODEL
return index;
#else
@@ -356,11 +356,12 @@ inline QModelIndex QFileDialogPrivate::mapFromSource(const QModelIndex &index) c
#endif
}
-inline QString QFileDialogPrivate::rootPath() const {
+QString QFileDialogPrivate::rootPath() const
+{
return (model ? model->rootPath() : QStringLiteral("/"));
}
-inline void QFileDialogPrivate::setDirectory_sys(const QUrl &directory)
+void QFileDialogPrivate::setDirectory_sys(const QUrl &directory)
{
QPlatformFileDialogHelper *helper = platformFileDialogHelper();
@@ -371,14 +372,14 @@ inline void QFileDialogPrivate::setDirectory_sys(const QUrl &directory)
helper->setDirectory(directory);
}
-inline QUrl QFileDialogPrivate::directory_sys() const
+QUrl QFileDialogPrivate::directory_sys() const
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
return helper->directory();
return QUrl();
}
-inline void QFileDialogPrivate::selectFile_sys(const QUrl &filename)
+void QFileDialogPrivate::selectFile_sys(const QUrl &filename)
{
QPlatformFileDialogHelper *helper = platformFileDialogHelper();
@@ -389,20 +390,20 @@ inline void QFileDialogPrivate::selectFile_sys(const QUrl &filename)
helper->selectFile(filename);
}
-inline QList QFileDialogPrivate::selectedFiles_sys() const
+QList QFileDialogPrivate::selectedFiles_sys() const
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
return helper->selectedFiles();
return QList();
}
-inline void QFileDialogPrivate::setFilter_sys()
+void QFileDialogPrivate::setFilter_sys()
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
helper->setFilter();
}
-inline void QFileDialogPrivate::selectMimeTypeFilter_sys(const QString &filter)
+void QFileDialogPrivate::selectMimeTypeFilter_sys(const QString &filter)
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
helper->selectMimeTypeFilter(filter);
@@ -416,13 +417,13 @@ QString QFileDialogPrivate::selectedMimeTypeFilter_sys() const
return QString();
}
-inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter)
+void QFileDialogPrivate::selectNameFilter_sys(const QString &filter)
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
helper->selectNameFilter(filter);
}
-inline QString QFileDialogPrivate::selectedNameFilter_sys() const
+QString QFileDialogPrivate::selectedNameFilter_sys() const
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
return helper->selectedNameFilter();
--
cgit v1.2.3
From 705c716543f2c318dc7b455d881fe0c8a6a467bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?=
Date: Fri, 21 Apr 2017 16:09:05 +0200
Subject: macOS: Add auto-release pools for Q*ApplicationPrivate::init()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
So that any objects autoreleased during application initialization are
released. Otherwise they will end up in the root level pool and only
be released when the application exits and the application goes out
of scope.
Change-Id: If02d24fd70098f9b4b1b0ea3218e0a15e438b9db
Reviewed-by: Morten Johan Sørvig
---
src/widgets/kernel/qapplication.cpp | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'src/widgets')
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 0e4ee30c19..4ab43628b9 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -564,6 +564,10 @@ QApplication::QApplication(int &argc, char **argv, int _internal)
*/
void QApplicationPrivate::init()
{
+#if defined(Q_OS_MACOS)
+ QMacAutoReleasePool pool;
+#endif
+
QGuiApplicationPrivate::init();
initResources();
--
cgit v1.2.3
From 46543bb462c4709d622080a0c32901a95f8d8963 Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich
Date: Mon, 1 May 2017 12:54:48 +0700
Subject: QMenu: Refactor column layout logic
Change-Id: I30f1c87092447abf1c94e69c0124eeeee43666e2
Reviewed-by: Friedemann Kleint
---
src/widgets/widgets/qmenu.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 4a3291b2ca..75704f73de 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -327,8 +327,8 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
const int deskFw = style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, &opt, q);
const int tearoffHeight = tearoff ? style->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, q) : 0;
const int base_y = vmargin + fw + topmargin + (scroll ? scroll->scrollOffset : 0) + tearoffHeight;
+ const int column_max_y = screen.height() - 2 * deskFw - (vmargin + bottommargin + fw);
int max_column_width = 0;
- int dh = screen.height();
int y = base_y;
//for compatibility now - will have to refactor this away
@@ -406,8 +406,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
if (!sz.isEmpty()) {
max_column_width = qMax(max_column_width, sz.width());
//wrapping
- if (!scroll &&
- y + sz.height() + vmargin + bottommargin + fw > dh - (deskFw * 2)) {
+ if (!scroll && y + sz.height() > column_max_y) {
ncols++;
y = base_y;
} else {
@@ -433,8 +432,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
QRect &rect = actionRects[i];
if (rect.isNull())
continue;
- if (!scroll &&
- y + rect.height() + vmargin + bottommargin + fw > dh - deskFw * 2) {
+ if (!scroll && y + rect.height() > column_max_y) {
x += max_column_width + hmargin;
y = base_y;
}
--
cgit v1.2.3
From 2f92bd7cd7452d97c344d373c7e59b34f99a9c42 Mon Sep 17 00:00:00 2001
From: Stephan Binner
Date: Wed, 26 Apr 2017 09:09:49 +0200
Subject: Fix warning for -no-feature-graphicsview
Change-Id: I3229fccd2f837b8b8b4da2a149d4584cb4a54dab
Reviewed-by: Oswald Buddenhagen
Reviewed-by: Tasuku Suzuki
Reviewed-by: Lars Knoll
---
src/widgets/util/qflickgesture.cpp | 2 ++
1 file changed, 2 insertions(+)
(limited to 'src/widgets')
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 10e92e04e1..71c4458b79 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -292,6 +292,8 @@ protected:
qFGDebug() << "QFG: ungrabbing" << grabber;
grabber->ungrabMouse();
}
+#else
+ Q_UNUSED(flags);
#endif // QT_NO_GRAPHICSVIEW
if (me) {
--
cgit v1.2.3
From 35f927e719eb50b90dcfc76ca63c72a38ef821d7 Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich
Date: Mon, 1 May 2017 11:43:05 +0700
Subject: QMenu: Ensure popup() gets the right screen geometry
Many QMenu related functions end up calling sizeHint() which
does call updateActionRects(). Since we try not to update the
action rects if no action has changed, we must be careful to
call it the first time with the right screen geometry. Other-
wise, multi-display setups may get the action rects based on
the wrong display.
In QMenu::popup(), this can be solved by using the position
passed as argument. Incidentally, we were already computing
the right display geometry in the same function, only a bit
later. The updated position around an eventual push button
menu should not change the screen onto which the menu popup
will be displayed.
Tested with the multiscreen-menus manual test.
Change-Id: Id7fc24be6908b4a9d24b8b9c8b8006efe45d69be
Reviewed-by: Friedemann Kleint
Reviewed-by: Olivier Goffart (Woboq GmbH)
---
src/widgets/widgets/qmenu.cpp | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
(limited to 'src/widgets')
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 75704f73de..2cafe462b1 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -2323,16 +2323,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
ensurePolished(); // Get the right font
emit aboutToShow();
const bool actionListChanged = d->itemsDirty;
- d->updateActionRects();
- QPoint pos;
- QPushButton *causedButton = qobject_cast(d->causedPopup.widget);
- if (actionListChanged && causedButton)
- pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition();
- else
- pos = p;
- const QSize menuSizeHint(sizeHint());
- QSize size = menuSizeHint;
QRect screen;
#ifndef QT_NO_GRAPHICSVIEW
bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this);
@@ -2341,6 +2332,17 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
else
#endif
screen = d->popupGeometry(QApplication::desktop()->screenNumber(p));
+ d->updateActionRects(screen);
+
+ QPoint pos;
+ QPushButton *causedButton = qobject_cast(d->causedPopup.widget);
+ if (actionListChanged && causedButton)
+ pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition();
+ else
+ pos = p;
+
+ const QSize menuSizeHint(sizeHint());
+ QSize size = menuSizeHint;
const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this);
bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen);
--
cgit v1.2.3
From 877ef0594d94f48bf063446b1f8a4b5e1941a8cd Mon Sep 17 00:00:00 2001
From: Venugopal Shivashankar
Date: Wed, 26 Apr 2017 16:03:25 +0200
Subject: Doc: Add information about styling QTableView::indicator
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Task-number: QTBUG-60245
Change-Id: I068d74d3d1d3ffb872ac6fec830367d67b65049d
Reviewed-by: Topi Reiniö
Reviewed-by: Frederik Gladhorn
---
src/widgets/doc/images/tableWidget-stylesheet.png | Bin 3478 -> 14135 bytes
.../doc/snippets/code/doc_src_stylesheet.qdoc | 6 ++++++
.../doc/src/widgets-and-layouts/stylesheet.qdoc | 6 ++++++
3 files changed, 12 insertions(+)
(limited to 'src/widgets')
diff --git a/src/widgets/doc/images/tableWidget-stylesheet.png b/src/widgets/doc/images/tableWidget-stylesheet.png
index e99e7a97c8..8c0669838c 100644
Binary files a/src/widgets/doc/images/tableWidget-stylesheet.png and b/src/widgets/doc/images/tableWidget-stylesheet.png differ
diff --git a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc
index afe38b24e9..dfea9f2ca4 100644
--- a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc
+++ b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc
@@ -1883,3 +1883,9 @@ QTabBar::close-button:hover {
* { lineedit-password-mask-delay: 1000 }
//! [160]
+//! [161]
+QTableView::indicator:unchecked {
+ background-color: #d7d6d5
+}
+//! [161]
+
diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
index 61379fb2f0..6745b78898 100644
--- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -3904,6 +3904,12 @@
\snippet code/doc_src_stylesheet.qdoc 150
+ The QTableView's checkbox indicator can also be customized. In the
+ following snippet the indicator \c background-color in unchecked state is
+ customized:
+
+ \snippet code/doc_src_stylesheet.qdoc 161
+
\section2 Customizing QToolBar
The background and the handle of a QToolBar is customized as below:
--
cgit v1.2.3