diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-12-18 16:05:52 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-12-18 19:35:11 +0100 |
commit | 322e5b7f5e35db73f7d7730a6fff558e153ad356 (patch) | |
tree | a029cf540194cc34d6914e81fd3ac7794aef9d18 /src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp | |
parent | 2614347ab8aa0ec0b1ea8f383ae795cfdb6ae2ac (diff) |
QtWidget docs: small fixes
Apply some minor fixes to the widget docs
- use nullptr
- use c++11 initializer list
- properly delete widget when cleaning the layout (QTBUG-29471)
- rework CardLayout example to make it work with Qt5
Fixes: QTBUG-29471
Change-Id: Ie2ee9f75eb8faf97d2bbd2c25e7013d4f30d8dd0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp')
-rw-r--r-- | src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp index d9f70b91ed..dd0f860c01 100644 --- a/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp +++ b/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp @@ -52,8 +52,7 @@ int MyLayout::heightForWidth(int w) const { if (cache_dirty || cached_width != w) { - // not all C++ compilers support "mutable" - MyLayout *that = (MyLayout*)this; + MyLayout *that = const_cast<MyLayout *>(this); int h = calculateHeightForWidth(w); that->cached_hfw = h; return h; |