Ok figured it out, its suprisingly simple...
https://doc.qt.io/qt-6/style-reference.html#tree-branch-indicators
int xMid = rect.center().x();
int yMid = rect.center().y();
int dotRadius = 4;
QRect indicatorRect(xMid - 5, yMid - 5, 10, 10);
const auto state = viewOpt->state;
if (state & State_Children) {
painter->setPen(Qt::red);
painter->drawRect(indicatorRect);
if (state & State_Open) {
painter->setPen(Qt::blue);
painter->drawEllipse(QPoint(xMid, yMid), dotRadius, dotRadius);
} else {
painter->setPen(QColor(0, 0, 0));
painter->drawLine(0, yMid, rect.right(), yMid);
}
}
if (state & State_Item) {
painter->setPen(QColor(0, 150, 0));
painter->drawEllipse(QPoint(xMid, yMid), dotRadius / 2, dotRadius / 2);
if (state & State_Sibling) {
painter->drawLine(xMid, rect.top(), xMid, rect.bottom());
} else {
painter->drawLine(xMid, rect.top(), xMid, yMid);
painter->drawLine(xMid, yMid, rect.right(), yMid);
}
} else {
painter->setPen(QPen(QColor(0, 150, 150), 4));
if (state & State_Sibling) {
painter->drawLine(xMid, rect.top(), xMid, rect.bottom());
}
}
[image: 9976c1f5-c57d-4236-9c09-4e7222ed9cbc.png]