MCPcopy Create free account
hub / github.com/KDE/kdevelop / drawRow

Method drawRow

plugins/quickopen/expandingtree/expandingtree.cpp:33–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void 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
63int ExpandingTree::sizeHintForColumn(int column) const
64{

Callers

nothing calls this directly

Calls 9

modelFunction · 0.85
isPartiallyExpandedMethod · 0.80
partialExpandRectMethod · 0.80
drawPrimitiveMethod · 0.80
topMethod · 0.80
setHtmlMethod · 0.80
partialExpandTextMethod · 0.80
mapToSourceMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected