diff options
author | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2012-02-06 09:24:50 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-18 18:40:15 +0100 |
commit | 466107107a85e7211c4b7f77b36ec50625657061 (patch) | |
tree | 9eb0d64ac6a2ba4e2f0a110322c19cfc879cd047 /src/widgets/kernel | |
parent | 908a080006faff333b061b69b0dc0fd9cab36114 (diff) |
Adding hasHeightForWidth as a virtual Widget funcion
Just implements what the note states (and removes the private function)
Change-Id: I9a6fd5134460712accf09ba01691df8b9b1f5d0d
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qlayoutitem.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 15 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.h | 1 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 1 |
4 files changed, 6 insertions, 13 deletions
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 860f1cc193..664334d725 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -522,7 +522,7 @@ bool QWidgetItem::hasHeightForWidth() const { if (isEmpty()) return false; - return wid->d_func()->hasHeightForWidth(); + return wid->hasHeightForWidth(); } /*! diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index f095e475af..44995f0959 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9226,19 +9226,12 @@ int QWidget::heightForWidth(int w) const /*! - \internal - - *virtual private* - - This is a bit hackish, but ideally we would have created a virtual function - in the public API (however, too late...) so that subclasses could reimplement - their own function. - Instead we add a virtual function to QWidgetPrivate. - ### Qt5: move to public class and make virtual + Returns true if the widget's preferred height depends on its width; otherwise returns false. */ -bool QWidgetPrivate::hasHeightForWidth() const +bool QWidget::hasHeightForWidth() const { - return layout ? layout->hasHeightForWidth() : size_policy.hasHeightForWidth(); + Q_D(const QWidget); + return d->layout ? d->layout->hasHeightForWidth() : d->size_policy.hasHeightForWidth(); } /*! diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 0594fd6f50..78b693c78d 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -524,6 +524,7 @@ public: void setSizePolicy(QSizePolicy); inline void setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical); virtual int heightForWidth(int) const; + virtual bool hasHeightForWidth() const; QRegion visibleRegion() const; diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 0da0c65aaa..8b66f14540 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -468,7 +468,6 @@ public: bool setMinimumSize_helper(int &minw, int &minh); bool setMaximumSize_helper(int &maxw, int &maxh); - virtual bool hasHeightForWidth() const; void setConstraints_sys(); bool pointInsideRectAndMask(const QPoint &) const; QWidget *childAt_helper(const QPoint &, bool) const; |