summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2012-12-12 12:55:21 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-12 14:49:46 +0100
commitf97c8d40c3eafa4360d6c2e51978c8de551e809a (patch)
tree309f59b6bebbbfb331cfecc063770ba1be4f6068 /src/gui/kernel/qwindow.h
parent303ff1bb1267322a730a5e7ac5a71a12d69d906a (diff)
De-inline all setters in QWindow
If we don't do this, we can have binary compatibility issues later. For example https://codereview.qt-project.org/#change,41700 will change the behavior of setWidth and setHeight to call setSize instead of setGeometry, because we don't want changing the height to also set the position of a window; if x and y are left uninitialized it needs to remember that fact. But if setWidth is left as an inline method, calling setGeometry, then an application which was built with 5.0 would behave differently than an application built with 5.1, even if Qt is upgraded after the application was built. To generalize, setters should never be inlined. Change-Id: I1ec42cb61a45fe541b3f3bb99d1b1ca24ad2a517 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.h')
-rw-r--r--src/gui/kernel/qwindow.h43
1 files changed, 12 insertions, 31 deletions
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 6dcd4ed477..c1a8e7971a 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -172,10 +172,10 @@ public:
bool isExposed() const;
- int minimumWidth() const { return minimumSize().width(); }
- int minimumHeight() const { return minimumSize().height(); }
- int maximumWidth() const { return maximumSize().width(); }
- int maximumHeight() const { return maximumSize().height(); }
+ inline int minimumWidth() const { return minimumSize().width(); }
+ inline int minimumHeight() const { return minimumSize().height(); }
+ inline int maximumWidth() const { return maximumSize().width(); }
+ inline int maximumHeight() const { return maximumSize().height(); }
QSize minimumSize() const;
QSize maximumSize() const;
@@ -187,7 +187,7 @@ public:
void setBaseSize(const QSize &size);
void setSizeIncrement(const QSize &size);
- void setGeometry(int posx, int posy, int w, int h) { setGeometry(QRect(posx, posy, w, h)); }
+ void setGeometry(int posx, int posy, int w, int h);
void setGeometry(const QRect &rect);
QRect geometry() const;
@@ -205,11 +205,11 @@ public:
inline QSize size() const { return geometry().size(); }
inline QPoint position() const { return geometry().topLeft(); }
- inline void setPosition(const QPoint &pt) { setGeometry(QRect(pt, size())); }
- inline void setPosition(int posx, int posy) { setPosition(QPoint(posx, posy)); }
+ void setPosition(const QPoint &pt);
+ void setPosition(int posx, int posy);
void resize(const QSize &newSize);
- inline void resize(int w, int h) { resize(QSize(w, h)); }
+ void resize(int w, int h);
void setFilePath(const QString &filePath);
QString filePath() const;
@@ -256,29 +256,10 @@ public Q_SLOTS:
void setTitle(const QString &);
- void setX(int arg)
- {
- if (x() != arg)
- setGeometry(QRect(arg, y(), width(), height()));
- }
-
- void setY(int arg)
- {
- if (y() != arg)
- setGeometry(QRect(x(), arg, width(), height()));
- }
-
- void setWidth(int arg)
- {
- if (width() != arg)
- setGeometry(QRect(x(), y(), arg, height()));
- }
-
- void setHeight(int arg)
- {
- if (height() != arg)
- setGeometry(QRect(x(), y(), width(), arg));
- }
+ void setX(int arg);
+ void setY(int arg);
+ void setWidth(int arg);
+ void setHeight(int arg);
void setMinimumWidth(int w);
void setMinimumHeight(int h);