| 158 | } |
| 159 | |
| 160 | void CollapseWidget::paintEvent(QPaintEvent *event) |
| 161 | { |
| 162 | DWidget::paintEvent(event); |
| 163 | QPainter painter(this); |
| 164 | QRect rect = CollapseWidget::rect(); |
| 165 | painter.drawLine(rect.topLeft() + QPoint{0, d->minHeight -1}, |
| 166 | rect.topRight() + QPoint{0, d->minHeight -1}); |
| 167 | painter.drawLine(rect.topLeft(), rect.topRight()); |
| 168 | painter.drawLine(rect.topLeft(), rect.bottomLeft()); |
| 169 | painter.drawLine(rect.topRight(), rect.bottomRight()); |
| 170 | painter.drawLine(rect.bottomLeft(), rect.bottomRight()); |
| 171 | |
| 172 | QFont font(d->title); |
| 173 | QFontMetrics fontMetrics(this->font()); |
| 174 | QRect textBoundingRect = fontMetrics.boundingRect(d->title); |
| 175 | QSize fontSize = textBoundingRect.size(); |
| 176 | int fontPosX = textBoundingRect.x(); |
| 177 | int fontPosY = textBoundingRect.y(); |
| 178 | int textPosX = 4 + ( fontPosX > 0 ? fontPosX : - fontPosX);; |
| 179 | int textPosY = (d->detailsButton->height() - fontSize.height()) / 2 |
| 180 | + ( fontPosY > 0 ? fontPosY: - fontPosY); |
| 181 | painter.drawText(QPoint{textPosX, textPosY}, d->title); |
| 182 | } |
| 183 | |
| 184 | void CollapseWidget::setChecked(bool checked) |
| 185 | { |
nothing calls this directly
no test coverage detected