summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2012-10-22 12:47:34 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-07 21:26:08 +0100
commitcd34da54269e6cd7fa5c18242d982736f022a14a (patch)
tree841d021b924f04dfcb7068fdbd9a428b9ce78c2f /src/gui/kernel/qwindow.h
parenta454ccb89ec2296234ee7328095f27ad7cb2361f (diff)
Rename all QWindow properties that have "window" in them
windowTitle, windowModality, windowIcon and so on are named that way to be similar to the ones in QWidget. However QQuickWindow inherits all of the declared properties, and we would like to have shorter property names in QML. If you are working with a Window then it's obvious the title property is the window title. Unfortunately, there must be patches in many other modules which depend on this one. In order to avoid the need to merge them all at the same time, there is also patch https://codereview.qt-project.org/#change,39001 which temporarily adds backwards-compatible accessors, which can be removed after the other modules are able to build without them. We should not rename windowState to state, because in QML, state usually drives the state machine for animation transitions etc. (although QWindow is not an Item, a user might get confused about it). Related patches are https://codereview.qt-project.org/#change,39001 https://codereview.qt-project.org/#change,37764 https://codereview.qt-project.org/#change,37765 https://codereview.qt-project.org/#change,37766 https://codereview.qt-project.org/#change,37762 Change-Id: Ie4424ec15fbdef6b29b137f90a2ae33f173edd21 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.h')
-rw-r--r--src/gui/kernel/qwindow.h47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 4832adfb63..1413d3db25 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -93,10 +93,15 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_OBJECT
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)
+ // All properties which are declared here are inherited by QQuickWindow and therefore available in QML.
+ // So please think carefully about what it does to the QML namespace if you add any new ones,
+ // particularly the possible meanings these names might have in any specializations of Window.
+ // For example "state" (meaning windowState) is not a good property to declare, because it has
+ // a different meaning in QQuickItem, and users will tend to assume it is the same for Window.
+
+ Q_PROPERTY(QString title READ title WRITE setTitle)
+ Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged)
+ Q_PROPERTY(Qt::WindowFlags flags READ flags WRITE setFlags)
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
@@ -110,9 +115,6 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
-#ifndef QT_NO_CURSOR
- Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor)
-#endif
public:
@@ -135,29 +137,29 @@ public:
bool isTopLevel() const;
bool isModal() const;
- Qt::WindowModality windowModality() const;
- void setWindowModality(Qt::WindowModality windowModality);
+ Qt::WindowModality modality() const;
+ void setModality(Qt::WindowModality modality);
void setFormat(const QSurfaceFormat &format);
QSurfaceFormat format() const;
QSurfaceFormat requestedFormat() const;
- void setWindowFlags(Qt::WindowFlags flags);
- Qt::WindowFlags windowFlags() const;
- Qt::WindowType windowType() const;
+ void setFlags(Qt::WindowFlags flags);
+ Qt::WindowFlags flags() const;
+ Qt::WindowType type() const;
- QString windowTitle() const;
+ QString title() const;
void setOpacity(qreal level);
- void requestActivateWindow();
+ void requestActivate();
bool isActive() const;
void reportContentOrientationChange(Qt::ScreenOrientation orientation);
Qt::ScreenOrientation contentOrientation() const;
- bool requestWindowOrientation(Qt::ScreenOrientation orientation);
- Qt::ScreenOrientation windowOrientation() const;
+ bool requestOrientation(Qt::ScreenOrientation orientation);
+ Qt::ScreenOrientation orientation() const;
Qt::WindowState windowState() const;
void setWindowState(Qt::WindowState state);
@@ -213,11 +215,11 @@ 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 setFilePath(const QString &filePath);
+ QString filePath() const;
- void setWindowIcon(const QIcon &icon);
- QIcon windowIcon() const;
+ void setIcon(const QIcon &icon);
+ QIcon icon() const;
void destroy();
@@ -256,7 +258,7 @@ public Q_SLOTS:
void raise();
void lower();
- void setWindowTitle(const QString &);
+ void setTitle(const QString &);
void setX(int arg)
{
@@ -289,7 +291,8 @@ public Q_SLOTS:
Q_SIGNALS:
void screenChanged(QScreen *screen);
- void windowModalityChanged(Qt::WindowModality windowModality);
+ void modalityChanged(Qt::WindowModality modality);
+ void windowStateChanged(Qt::WindowState windowState);
void xChanged(int arg);
void yChanged(int arg);