MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / drawText

Method drawText

src/openms_gui/source/VISUAL/MISC/GUIHelpers.cpp:137–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135 }
136
137 void GUIHelpers::drawText(QPainter& painter, const QStringList& text, const QPoint& where, const QColor& col_fg, const QColor& col_bg, const QFont& f)
138 {
139 painter.save();
140
141 // font
142 painter.setFont(f);
143
144 int line_spacing;
145 QRectF dim = getTextDimension(text, painter.font(), line_spacing);
146
147 // draw background for text
148 if (col_bg.isValid()) painter.fillRect(where.x(), where.y(), dim.width(), dim.height(), col_bg);
149
150 // draw text
151 if (col_fg.isValid()) painter.setPen(col_fg);
152
153 for (int i = 0; i < text.size(); ++i)
154 {
155 painter.drawText(where.x() + 1, where.y() + (i + 1) * line_spacing, text[i]);
156 }
157 painter.restore();
158 }
159
160 QRectF GUIHelpers::getTextDimension(const QStringList& text, const QFont& f, int& line_spacing)
161 {

Callers 15

paintMethod · 0.80
paintEventMethod · 0.80
renderText_Method · 0.80
paintPeptideIDs_Method · 0.80
paintMethod · 0.80
paintMethod · 0.80
paintMethod · 0.80
paintMethod · 0.80
paintMethod · 0.80
paintMethod · 0.80
paintMethod · 0.80
paintMethod · 0.80

Calls 4

widthMethod · 0.80
heightMethod · 0.80
isValidMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected