MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / titleBarWidth

Method titleBarWidth

src/domain/UBGraphicsTextItemDelegate.cpp:178–198  ·  view source on GitHub ↗

* @brief Calculate the width of the toolbar containing the text item-related buttons * @return The space between the left-most and right-most buttons in pixels */

Source from the content-addressed store, hash-verified

176 * @return The space between the left-most and right-most buttons in pixels
177 */
178qreal UBGraphicsTextItemDelegate::titleBarWidth()
179{
180 if (!mFontButton)
181 return 0;
182
183 // refresh the frame and buttons' positions
184 positionHandles();
185
186 qreal titleBarWidth(0);
187 qreal frameLeftCoordinate = mFontButton->pos().x();
188 qreal frameRightCoordinate = frameLeftCoordinate;
189
190 foreach(DelegateButton* button, mButtons) {
191 if (button->getSection() == Qt::TitleBarArea) {
192 frameLeftCoordinate = qMin(button->pos().x(), frameLeftCoordinate);
193 frameRightCoordinate = qMax(button->pos().x() + button->boundingRect().width(), frameRightCoordinate);
194 }
195 }
196
197 return frameRightCoordinate - frameLeftCoordinate;
198}
199
200void UBGraphicsTextItemDelegate::freeButtons()
201{

Callers 2

mouseReleaseEventMethod · 0.80
setTextWidthMethod · 0.80

Calls 1

posMethod · 0.80

Tested by

no test coverage detected