summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qwidget.cpp28
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp1
3 files changed, 21 insertions, 10 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 662c9b7403..ddab66944e 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -10322,20 +10322,30 @@ void QWidget::setWindowModified(bool mod)
Q_D(QWidget);
setAttribute(Qt::WA_WindowModified, mod);
-#ifndef Q_WS_MAC
- if (!windowTitle().contains(QLatin1String("[*]")) && mod)
- qWarning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
-#endif
- d->setWindowTitle_helper(windowTitle());
- d->setWindowIconText_helper(windowIconText());
-#ifdef Q_WS_MAC
- d->setWindowModified_sys(mod);
-#endif
+ d->setWindowModified_helper();
QEvent e(QEvent::ModifiedChange);
QApplication::sendEvent(this, &e);
}
+void QWidgetPrivate::setWindowModified_helper()
+{
+ Q_Q(QWidget);
+ QWindow *window = q->windowHandle();
+ if (!window)
+ return;
+ QPlatformWindow *platformWindow = window->handle();
+ if (!platformWindow)
+ return;
+ bool on = q->testAttribute(Qt::WA_WindowModified);
+ if (!platformWindow->setWindowModified(on)) {
+ if (!q->windowTitle().contains(QLatin1String("[*]")) && on)
+ qWarning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
+ setWindowTitle_helper(q->windowTitle());
+ setWindowIconText_helper(q->windowIconText());
+ }
+}
+
#ifndef QT_NO_TOOLTIP
/*!
\property QWidget::toolTip
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index d3fcdce6a8..d7c0ec75b0 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -466,6 +466,7 @@ public:
void setWindowTitle_helper(const QString &cap);
void setWindowFilePath_helper(const QString &filePath);
+ void setWindowModified_helper();
bool setMinimumSize_helper(int &minw, int &minh);
bool setMaximumSize_helper(int &maxw, int &maxh);
@@ -745,7 +746,6 @@ public:
void update_sys(const QRect &rect);
void update_sys(const QRegion &rgn);
void setGeometry_sys_helper(int, int, int, int, bool);
- void setWindowModified_sys(bool b);
void updateMaximizeButton_sys();
void setWindowFilePath_sys(const QString &filePath);
void createWindow_sys();
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 4fe7ad6dc7..6b6dd12703 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -140,6 +140,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
q->setAttribute(Qt::WA_PaintOnScreen, true);
}
+ setWindowModified_helper();
setWinId(win->winId());
// first check children. and create them if necessary