int FlowLayout::widthForHeight( int h ) const { if ( _cachedH != h ) { //Not all C++ compilers support "mutable" yet: FlowLayout * mthis = (FlowLayout*)this; int w = mthis->doLayout( QRect(0,0,0,h), true ); mthis->_cachedH = h; mthis->_cachedW = w; return w; } return _cachedW; }
int FlowLayout::heightForWidth( int w ) const { if ( _cachedW != w ) { //Not all C++ compilers support "mutable" yet: FlowLayout * mthis = (FlowLayout*)this; int h = mthis->doLayout( QRect(0,0,w,0), true ); mthis->_cachedH = h; mthis->_cachedW = w; return h; } return _cachedH; }