* @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 */
| 176 | * @return The space between the left-most and right-most buttons in pixels |
| 177 | */ |
| 178 | qreal 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 | |
| 200 | void UBGraphicsTextItemDelegate::freeButtons() |
| 201 | { |
no test coverage detected