50 if ( index < mLeftItems.size() )
51 return mLeftItems.at( index );
52 index -= mLeftItems.size();
54 if ( index < mRightItems.size() )
55 return mRightItems.at( index );
56 index -= mRightItems.size();
58 if ( index < mTopItems.size() )
59 return mTopItems.at( index );
60 index -= mTopItems.size();
62 if ( index < mBottomItems.size() )
63 return mBottomItems.at( index );
73 if ( index < mLeftItems.size() )
74 return mLeftItems.takeAt( index );
75 index -= mLeftItems.size();
77 if ( index < mRightItems.size() )
78 return mRightItems.takeAt( index );
79 index -= mRightItems.size();
81 if ( index < mTopItems.size() )
82 return mTopItems.takeAt( index );
83 index -= mTopItems.size();
85 if ( index < mBottomItems.size() )
86 return mBottomItems.takeAt( index );
111 QLayout::setGeometry( rect );
116 int bottomMargin = 0;
117 getContentsMargins( &leftMargin, &topMargin, &rightMargin, &bottomMargin );
120 const int innerLeft = rect.left() + leftMargin;
121 const int innerRight = rect.right() - rightMargin;
122 const int innerTop = rect.top() + topMargin;
123 const int innerBottom = rect.bottom() - bottomMargin;
124 const int innerHeight = innerBottom - innerTop;
126 int left = innerLeft;
127 for ( QLayoutItem *item : std::as_const( mLeftItems ) )
129 const QSize
sizeHint = item->sizeHint();
130 item->setGeometry( QRect( left, innerTop,
sizeHint.width(), innerHeight ) );
131 left +=
sizeHint.width() + mHorizontalSpacing;
134 int right = innerRight;
135 for ( QLayoutItem *item : std::as_const( mRightItems ) )
137 const QSize
sizeHint = item->sizeHint();
138 item->setGeometry( QRect( right -
sizeHint.width(), innerTop,
sizeHint.width(), innerHeight ) );
139 right -=
sizeHint.width() + mHorizontalSpacing;
143 for ( QLayoutItem *item : std::as_const( mTopItems ) )
145 const QSize
sizeHint = item->sizeHint();
146 item->setGeometry( QRect( left, top, right - left,
sizeHint.height() ) );
147 top +=
sizeHint.height() + mVerticalSpacing;
150 int bottom = innerBottom;
151 for ( QLayoutItem *item : std::as_const( mBottomItems ) )
153 const QSize
sizeHint = item->sizeHint();
154 item->setGeometry( QRect( left, bottom -
sizeHint.height(), right - left,
sizeHint.height() ) );
155 bottom -=
sizeHint.height() + mVerticalSpacing;
161 QWidgetItem *widgetItem =
new QWidgetItem( widget );
165 mLeftItems.append( widgetItem );
168 mRightItems.append( widgetItem );
171 mTopItems.append( widgetItem );
174 mBottomItems.append( widgetItem );
178 addChildWidget( widget );