diff options
Diffstat (limited to 'doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp')
-rw-r--r-- | doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp b/doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp new file mode 100644 index 0000000..db6438e --- /dev/null +++ b/doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp @@ -0,0 +1,13 @@ +//! [0] +int MyLayout::heightForWidth(int w) const +{ + if (cache_dirty || cached_width != w) { + // not all C++ compilers support "mutable" + MyLayout *that = (MyLayout*)this; + int h = calculateHeightForWidth(w); + that->cached_hfw = h; + return h; + } + return cached_hfw; +} +//! [0] |