| 31 | } |
| 32 | |
| 33 | void ExpandingTree::drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const |
| 34 | { |
| 35 | QTreeView::drawRow(painter, option, index); |
| 36 | |
| 37 | const auto* eModel = qobject_cast<const ExpandingWidgetModel*>(qobject_cast<const QAbstractProxyModel*>(model())->sourceModel()); |
| 38 | Q_ASSERT(eModel); |
| 39 | const QModelIndex sourceIndex = eModel->mapToSource(index); |
| 40 | if (eModel->isPartiallyExpanded(sourceIndex) != ExpandingWidgetModel::ExpansionType::NotExpanded) { |
| 41 | QRect rect = eModel->partialExpandRect(sourceIndex); |
| 42 | if (rect.isValid()) { |
| 43 | QStyleOption opt; |
| 44 | QAbstractTextDocumentLayout::PaintContext ctx; |
| 45 | |
| 46 | opt.rect = rect; |
| 47 | style()->drawPrimitive(QStyle::PE_FrameLineEdit, &opt, painter); |
| 48 | |
| 49 | ctx.clip = QRectF(0, 0, rect.width(), rect.height()); |
| 50 | painter->setViewTransformEnabled(true); |
| 51 | painter->translate(rect.left(), rect.top()); |
| 52 | |
| 53 | m_drawText.setHtml(eModel->partialExpandText(sourceIndex)); |
| 54 | WidgetColorizer::convertDocumentToDarkTheme(&m_drawText); |
| 55 | m_drawText.setPageSize(QSizeF(rect.width(), rect.height())); |
| 56 | m_drawText.documentLayout()->draw(painter, ctx); |
| 57 | |
| 58 | painter->translate(-rect.left(), -rect.top()); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | int ExpandingTree::sizeHintForColumn(int column) const |
| 64 | { |
nothing calls this directly
no test coverage detected