diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-09-21 15:25:11 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-11-27 08:46:29 +0200 |
commit | ce7447d88ce5f410ae01b0f5697a86b3ba7c47f2 (patch) | |
tree | 9b813fa59da6fd21e7b928839b2e93f9b263e592 /src/widgets/kernel/qlayoutitem.cpp | |
parent | 2260d680c935eae0e989beb2040a01040f66a5fa (diff) |
QLayoutItem: make QLayoutItem::widget() const in Qt6
QLayoutItem::widget() should be const since it does not modify the
class. Since this can not be done within Qt5 in a binary compatible way,
change it for Qt6.
Fixes: QTBUG-41997
Change-Id: I9211eb1c36a5bc4f06ab417a9df790ebedb7fcda
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/kernel/qlayoutitem.cpp')
-rw-r--r-- | src/widgets/kernel/qlayoutitem.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index ca5a89e4dc..fc02afb014 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -291,14 +291,12 @@ void QSpacerItem::changeSize(int w, int h, QSizePolicy::Policy hPolicy, /*! Destructor. */ -QWidgetItem::~QWidgetItem() {} +QWidgetItem::~QWidgetItem() = default; /*! Destroys the QLayoutItem. */ -QLayoutItem::~QLayoutItem() -{ -} +QLayoutItem::~QLayoutItem() = default; /*! Invalidates any cached information in this layout item. @@ -362,7 +360,11 @@ QSpacerItem * QSpacerItem::spacerItem() \sa layout(), spacerItem() */ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QWidget *QLayoutItem::widget() +#else +QWidget *QLayoutItem::widget() const +#endif { return nullptr; } @@ -370,7 +372,11 @@ QWidget *QLayoutItem::widget() /*! Returns the widget managed by this item. */ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QWidget *QWidgetItem::widget() +#else +QWidget *QWidgetItem::widget() const +#endif { return wid; } |