Implement QWindow::setWindowIcon
Since QIcon has been moved back to QtGui, QWindow::setWindowIcon can use it. That way, the api is exactly the same as in QWidgets and one can deal properly with multi-sized icon. I added a getter so the api is consistent with QWidget (Maybe there should be properties for windowIcon and windowTitle) Change-Id: I2f463dbe39673f41a3201ef8fed27b3fcac2125f Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
This commit is contained in:
parent
df7a1a28aa
commit
ce3d1a153a
@ -67,6 +67,7 @@ QT_BEGIN_NAMESPACE
|
||||
class QPlatformScreen;
|
||||
class QPlatformWindowPrivate;
|
||||
class QWindow;
|
||||
class QIcon;
|
||||
|
||||
class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface
|
||||
{
|
||||
@ -95,6 +96,7 @@ public:
|
||||
virtual void setParent(const QPlatformWindow *window);
|
||||
|
||||
virtual void setWindowTitle(const QString &title);
|
||||
virtual void setWindowIcon(const QIcon &icon);
|
||||
virtual void raise();
|
||||
virtual void lower();
|
||||
|
||||
|
@ -215,6 +215,11 @@ void QPlatformWindow::setParent(const QPlatformWindow *parent)
|
||||
*/
|
||||
void QPlatformWindow::setWindowTitle(const QString &title) { Q_UNUSED(title); }
|
||||
|
||||
/*!
|
||||
Reimplement to set the window icon to \a icon
|
||||
*/
|
||||
void QPlatformWindow::setWindowIcon(const QIcon &icon) { Q_UNUSED(icon); }
|
||||
|
||||
/*!
|
||||
Reimplement to be able to let Qt raise windows to the top of the desktop
|
||||
*/
|
||||
|
@ -516,9 +516,8 @@ void QWindow::setWindowTitle(const QString &title)
|
||||
{
|
||||
Q_D(QWindow);
|
||||
d->windowTitle = title;
|
||||
if (d->platformWindow) {
|
||||
if (d->platformWindow)
|
||||
d->platformWindow->setWindowTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
QString QWindow::windowTitle() const
|
||||
@ -527,6 +526,26 @@ QString QWindow::windowTitle() const
|
||||
return d->windowTitle;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the window icon to the given \a icon.
|
||||
|
||||
The window icon might be used by the windowing system for example to decorate the window,
|
||||
or in the task switcher.
|
||||
*/
|
||||
void QWindow::setWindowIcon(const QIcon &icon)
|
||||
{
|
||||
Q_D(QWindow);
|
||||
d->windowIcon = icon;
|
||||
if (d->platformWindow)
|
||||
d->platformWindow->setWindowIcon(icon);
|
||||
}
|
||||
|
||||
QIcon QWindow::windowIcon() const
|
||||
{
|
||||
Q_D(const QWindow);
|
||||
return d->windowIcon;
|
||||
}
|
||||
|
||||
/*!
|
||||
Raise the window in the windowing system.
|
||||
|
||||
@ -535,9 +554,8 @@ QString QWindow::windowTitle() const
|
||||
void QWindow::raise()
|
||||
{
|
||||
Q_D(QWindow);
|
||||
if (d->platformWindow) {
|
||||
if (d->platformWindow)
|
||||
d->platformWindow->raise();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -548,9 +566,8 @@ void QWindow::raise()
|
||||
void QWindow::lower()
|
||||
{
|
||||
Q_D(QWindow);
|
||||
if (d->platformWindow) {
|
||||
if (d->platformWindow)
|
||||
d->platformWindow->lower();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1055,18 +1072,6 @@ void QWindow::resize(const QSize &newSize)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the window icon to the given \a icon image.
|
||||
|
||||
The window icon might be used by the windowing system for example to decorate the window,
|
||||
or in the task switcher.
|
||||
*/
|
||||
void QWindow::setWindowIcon(const QImage &icon) const
|
||||
{
|
||||
Q_UNUSED(icon);
|
||||
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
|
||||
}
|
||||
|
||||
/*!
|
||||
Releases the native platform resources associated with this window.
|
||||
|
||||
|
@ -53,6 +53,8 @@
|
||||
#include <QtGui/qsurfaceformat.h>
|
||||
#include <QtGui/qwindowdefs.h>
|
||||
|
||||
#include <QtGui/qicon.h>
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
#include <QtGui/qcursor.h>
|
||||
#endif
|
||||
@ -89,6 +91,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
|
||||
Q_DECLARE_PRIVATE(QWindow)
|
||||
|
||||
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
|
||||
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
|
||||
Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged)
|
||||
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
|
||||
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
|
||||
@ -194,7 +197,8 @@ public:
|
||||
void resize(const QSize &newSize);
|
||||
inline void resize(int w, int h) { resize(QSize(w, h)); }
|
||||
|
||||
void setWindowIcon(const QImage &icon) const;
|
||||
void setWindowIcon(const QIcon &icon);
|
||||
QIcon windowIcon() const;
|
||||
|
||||
void destroy();
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <qpa/qplatformwindow.h>
|
||||
|
||||
#include <QtCore/private/qobject_p.h>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
@ -113,6 +114,7 @@ public:
|
||||
bool exposed;
|
||||
QSurfaceFormat requestedFormat;
|
||||
QString windowTitle;
|
||||
QIcon windowIcon;
|
||||
QRect geometry;
|
||||
Qt::WindowState windowState;
|
||||
bool resizeEventPending;
|
||||
|
Loading…
Reference in New Issue
Block a user