49 if ( index < mLeftItems.size() )
50 return mLeftItems.at( index );
51 index -= mLeftItems.size();
53 if ( index < mRightItems.size() )
54 return mRightItems.at( index );
55 index -= mRightItems.size();
57 if ( index < mTopItems.size() )
58 return mTopItems.at( index );
59 index -= mTopItems.size();
61 if ( index < mBottomItems.size() )
62 return mBottomItems.at( index );
72 if ( index < mLeftItems.size() )
73 return mLeftItems.takeAt( index );
74 index -= mLeftItems.size();
76 if ( index < mRightItems.size() )
77 return mRightItems.takeAt( index );
78 index -= mRightItems.size();
80 if ( index < mTopItems.size() )
81 return mTopItems.takeAt( index );
82 index -= mTopItems.size();
84 if ( index < mBottomItems.size() )
85 return mBottomItems.takeAt( index );
110 QLayout::setGeometry( rect );
115 int bottomMargin = 0;
116 getContentsMargins( &leftMargin, &topMargin, &rightMargin, &bottomMargin );
119 const int innerLeft = rect.left() + leftMargin;
120 const int innerRight = rect.right() - rightMargin;
121 const int innerTop = rect.top() + topMargin;
122 const int innerBottom = rect.bottom() - bottomMargin;
123 const int innerHeight = innerBottom - innerTop;
125 int left = innerLeft;
126 for ( QLayoutItem *item : std::as_const( mLeftItems ) )
128 const QSize
sizeHint = item->sizeHint();
129 item->setGeometry( QRect( left, innerTop,
sizeHint.width(), innerHeight ) );
130 left +=
sizeHint.width() + mHorizontalSpacing;
133 int right = innerRight;
134 for ( QLayoutItem *item : std::as_const( mRightItems ) )
136 const QSize
sizeHint = item->sizeHint();
137 item->setGeometry( QRect( right -
sizeHint.width(), innerTop,
sizeHint.width(), innerHeight ) );
138 right -=
sizeHint.width() + mHorizontalSpacing;
142 for ( QLayoutItem *item : std::as_const( mTopItems ) )
144 const QSize
sizeHint = item->sizeHint();
145 item->setGeometry( QRect( left, top, right - left,
sizeHint.height() ) );
146 top +=
sizeHint.height() + mVerticalSpacing;
149 int bottom = innerBottom;
150 for ( QLayoutItem *item : std::as_const( mBottomItems ) )
152 const QSize
sizeHint = item->sizeHint();
153 item->setGeometry( QRect( left, bottom -
sizeHint.height(), right - left,
sizeHint.height() ) );
154 bottom -=
sizeHint.height() + mVerticalSpacing;
160 QWidgetItem *widgetItem =
new QWidgetItem( widget );
164 mLeftItems.append( widgetItem );
167 mRightItems.append( widgetItem );
170 mTopItems.append( widgetItem );
173 mBottomItems.append( widgetItem );
177 addChildWidget( widget );