MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / drawObject

Method drawObject

MiniZincIDE/outputwidget.cpp:942–980  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940}
941
942void OutputWidgetArrow::drawObject(QPainter* painter, const QRectF& rect, QTextDocument* doc, int posInDocument, const QTextFormat& format)
943{
944 QFontMetrics metrics(format.toCharFormat().font());
945
946 QTextCursor cursor(doc);
947 cursor.setPosition(posInDocument);
948 auto t = cursor.currentTable();
949 assert(t != nullptr);
950 cursor.setPosition(t->lastPosition() + 2);
951 auto* f = cursor.currentFrame();
952 assert(f != nullptr);
953
954 auto ff = f->frameFormat();
955 bool expanded = ff.property(OutputWidget::Property::Expanded).toBool();
956
957 auto tf = t->format();
958 auto requiredFormat = static_cast<OutputWidget*>(parent())->headerTableFormat();
959 if (tf.columnWidthConstraints()[0].rawValue() !=
960 requiredFormat.columnWidthConstraints()[0].rawValue()) {
961 // Re-align
962 t->setFormat(requiredFormat);
963 f->setFrameFormat(static_cast<OutputWidget*>(parent())->frameFormat());
964 }
965
966 auto h2 = metrics.ascent() / 2;
967 auto w2 = h2 / 2;
968
969 QPainterPath p;
970 p.moveTo(-w2, -h2);
971 p.lineTo(w2, 0);
972 p.lineTo(-w2, h2);
973 p.closeSubpath();
974 painter->translate(rect.center());
975 if (expanded) {
976 painter->rotate(90);
977 }
978 auto infoFormat = static_cast<OutputWidget*>(parent())->infoCharFormat();
979 painter->fillPath(p, infoFormat.foreground());
980}
981
982void OutputWidget::on_toggleAll_pushButton_clicked()
983{

Callers

nothing calls this directly

Calls 2

frameFormatMethod · 0.80
headerTableFormatMethod · 0.80

Tested by

no test coverage detected