From: Joerg Bornemann Date: Mon, 1 Oct 2012 10:55:27 +0000 (+0200) Subject: QWindow::setWindowFilePath added X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24c403a2bd71578a1978baed1c60f08c12cd62c5;p=profile%2Fivi%2Fqtbase.git QWindow::setWindowFilePath added QWindow::setWindowFilePath sets the file path of the document that is currently represented by the window. The window system might display it in the window's title bar along with an icon matching the file type. Task-number: QTBUG-27299 Change-Id: I8f620d1262fc0b4cd16884198b16853b73ce3b1f Reviewed-by: Friedemann Kleint Reviewed-by: Morten Johan Sørvig --- diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 9e1e6be..cdf5c61 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -253,6 +253,11 @@ void QPlatformWindow::setParent(const QPlatformWindow *parent) void QPlatformWindow::setWindowTitle(const QString &title) { Q_UNUSED(title); } /*! + Reimplement to set the window file path to \a filePath +*/ +void QPlatformWindow::setWindowFilePath(const QString &filePath) { Q_UNUSED(filePath); } + +/*! Reimplement to set the window icon to \a icon */ void QPlatformWindow::setWindowIcon(const QIcon &icon) { Q_UNUSED(icon); } diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index 5586b3c..7ea17d0 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -97,6 +97,7 @@ public: virtual void setParent(const QPlatformWindow *window); virtual void setWindowTitle(const QString &title); + virtual void setWindowFilePath(const QString &title); virtual void setWindowIcon(const QIcon &icon); virtual void raise(); virtual void lower(); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 98c9451..1e2ac5b 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -571,6 +571,27 @@ QString QWindow::windowTitle() const } /*! + \property QWindow::windowFilePath + \brief the file name this window is representing. + + This property might be used by the windowing system to display the file + path of the document this window is representing in the tile bar. +*/ +void QWindow::setWindowFilePath(const QString &filePath) +{ + Q_D(QWindow); + d->windowFilePath = filePath; + if (d->platformWindow) + d->platformWindow->setWindowFilePath(filePath); +} + +QString QWindow::windowFilePath() const +{ + Q_D(const QWindow); + return d->windowFilePath; +} + +/*! \property QWindow::windowIcon \brief the window's icon in the windowing system diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index c3ac78f..62268cd 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -94,6 +94,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_DECLARE_PRIVATE(QWindow) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) + Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath) 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) @@ -203,6 +204,9 @@ public: void resize(const QSize &newSize); inline void resize(int w, int h) { resize(QSize(w, h)); } + void setWindowFilePath(const QString &filePath); + QString windowFilePath() const; + void setWindowIcon(const QIcon &icon); QIcon windowIcon() const; diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index caa5184..57f79f1 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -114,6 +114,7 @@ public: bool exposed; QSurfaceFormat requestedFormat; QString windowTitle; + QString windowFilePath; QIcon windowIcon; QRect geometry; Qt::WindowState windowState;