summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r--src/widgets/kernel/qapplication.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index f9db6155af..ebab87b193 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -360,7 +360,7 @@ void QApplicationPrivate::createEventDispatcher()
/*!
\fn QWidget *QApplication::topLevelAt(const QPoint &point)
- Returns the top-level widget at the given \a point; returns 0 if
+ Returns the top-level widget at the given \a point; returns \nullptr if
there is no such widget.
*/
QWidget *QApplication::topLevelAt(const QPoint &pos)
@@ -1226,7 +1226,7 @@ void QApplication::setStyle(QStyle *style)
"windows", "windowsvista", "fusion", or "macintosh". Style
names are case insensitive.
- Returns 0 if an unknown \a style is passed, otherwise the QStyle object
+ Returns \nullptr if an unknown \a style is passed, otherwise the QStyle object
returned is set as the application's GUI style.
\warning To ensure that the application's style is set correctly, it is
@@ -1420,24 +1420,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) {
// Send ApplicationPaletteChange to qApp itself, and to the widgets.
- QEvent e(QEvent::ApplicationPaletteChange);
- QApplication::sendEvent(QApplication::instance(), &e);
-
- QWidgetList wids = QApplication::allWidgets();
- for (QWidgetList::ConstIterator it = wids.constBegin(), cend = wids.constEnd(); it != cend; ++it) {
- QWidget *w = *it;
- if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class
- QApplication::sendEvent(w, &e);
- }
-
- // Send to all scenes as well.
-#if QT_CONFIG(graphicsview)
- QList<QGraphicsScene *> &scenes = qApp->d_func()->scene_list;
- for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin();
- it != scenes.constEnd(); ++it) {
- QApplication::sendEvent(*it, &e);
- }
-#endif // QT_CONFIG(graphicsview)
+ qApp->d_func()->sendApplicationPaletteChange(all, className);
}
if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) {
if (!QApplicationPrivate::set_pal)
@@ -2194,7 +2177,7 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
/*!internal
* Helper function that returns the new focus widget, but does not set the focus reason.
- * Returns 0 if a new focus widget could not be found.
+ * Returns \nullptr if a new focus widget could not be found.
* Shared with QGraphicsProxyWidgetPrivate::findFocusChild()
*/
QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next,
@@ -4508,6 +4491,23 @@ void QApplicationPrivate::notifyThemeChanged()
qt_init_tooltip_palette();
}
+void QApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className)
+{
+ QGuiApplicationPrivate::sendApplicationPaletteChange();
+
+ QEvent event(QEvent::ApplicationPaletteChange);
+ const QWidgetList widgets = QApplication::allWidgets();
+ for (auto widget : widgets) {
+ if (toAllWidgets || (!className && widget->isWindow()) || (className && widget->inherits(className)))
+ QApplication::sendEvent(widget, &event);
+ }
+
+#if QT_CONFIG(graphicsview)
+ for (auto scene : qAsConst(scene_list))
+ QApplication::sendEvent(scene, &event);
+#endif // QT_CONFIG(graphicsview)
+}
+
#if QT_CONFIG(draganddrop)
void QApplicationPrivate::notifyDragStarted(const QDrag *drag)
{