summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp
blob: db6438e434ab67d05e959f6190f24e5e3aea0018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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]