From 507a7b4df918a091c45af35110fd2cdeff3713aa Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Sun, 8 Sep 2013 10:23:17 +0100 Subject: Add missing notify signals for window title and icon changes. Adds signals for changes to the window title, window icon and window icon text. Change-Id: Ia0ddcb94dda2c9ea790edc061d487765024191cd Reviewed-by: Lars Knoll Reviewed-by: Marc Mutz --- src/widgets/kernel/qwidget.cpp | 33 +++++++++++++++++++++++++++++++++ src/widgets/kernel/qwidget.h | 9 ++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 5532b04b22..eea44300e8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5601,6 +5601,15 @@ void QWidgetPrivate::setWindowIconText_helper(const QString &title) setWindowIconText_sys(qt_setWindowTitle_helperHelper(title, q)); } +/*! + \fn void QWidget::windowIconTextChanged(const QString &iconText) + + This signal is emitted when the window's icon text has changed, with the + new \a iconText as an argument. + + \since 5.2 +*/ + void QWidget::setWindowIconText(const QString &iconText) { if (QWidget::windowIconText() == iconText) @@ -5612,8 +5621,19 @@ void QWidget::setWindowIconText(const QString &iconText) QEvent e(QEvent::IconTextChange); QApplication::sendEvent(this, &e); + + emit windowIconTextChanged(iconText); } +/*! + \fn void QWidget::windowTitleChanged(const QString &title) + + This signal is emitted when the window's title has changed, with the + new \a title as an argument. + + \since 5.2 +*/ + void QWidget::setWindowTitle(const QString &title) { if (QWidget::windowTitle() == title && !title.isEmpty() && !title.isNull()) @@ -5625,6 +5645,8 @@ void QWidget::setWindowTitle(const QString &title) QEvent e(QEvent::WindowTitleChange); QApplication::sendEvent(this, &e); + + emit windowTitleChanged(title); } @@ -5661,6 +5683,15 @@ void QWidgetPrivate::setWindowIcon_helper() } } +/*! + \fn void QWidget::windowIconChanged(const QIcon &icon) + + This signal is emitted when the window's icon has changed, with the + new \a icon as an argument. + + \since 5.2 +*/ + void QWidget::setWindowIcon(const QIcon &icon) { Q_D(QWidget); @@ -5674,6 +5705,8 @@ void QWidget::setWindowIcon(const QIcon &icon) d->setWindowIcon_sys(); d->setWindowIcon_helper(); + + emit windowIconChanged(icon); } diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index f579dbb9cd..a9eeaa5470 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -171,9 +171,9 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice Q_PROPERTY(QSize sizeHint READ sizeHint) Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint) Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops) - Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE isWindow) - Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon DESIGNABLE isWindow) - Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText DESIGNABLE isWindow) + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle NOTIFY windowTitleChanged DESIGNABLE isWindow) + Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged DESIGNABLE isWindow) + Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText NOTIFY windowIconTextChanged DESIGNABLE isWindow) Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow) Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow) #ifndef QT_NO_TOOLTIP @@ -599,6 +599,9 @@ public: friend class QDesktopScreenWidget; Q_SIGNALS: + void windowTitleChanged(const QString &title); + void windowIconChanged(const QIcon &icon); + void windowIconTextChanged(const QString &iconText); void customContextMenuRequested(const QPoint &pos); protected: -- cgit v1.2.3