MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / paintTextAt

Method paintTextAt

Components/FrequencyCorrectionDialog.cpp:116–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void
117FrequencyCorrectionDialog::paintTextAt(
118 QPainter &p,
119 QPointF where,
120 QString text,
121 bool center)
122{
123 int tw, th;
124 QFont font;
125
126 font.setPointSizeF(
127 FREQUENCY_CORRECTION_DIALOG_OVERSAMPLING * font.pointSizeF());
128
129 QFontMetrics metrics(font);
130 QRect rect;
131
132 th = metrics.height();
133
134#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
135 tw = metrics.horizontalAdvance(text);
136#else
137 tw = metrics.width(text);
138#endif // QT_VERSION_CHECK
139
140 if (center)
141 rect.setRect(
142 static_cast<int>(where.x() - .5 * tw),
143 static_cast<int>(where.y() - .5 * th),
144 tw,
145 th);
146 else
147 rect.setRect(
148 static_cast<int>(where.x()),
149 static_cast<int>(where.y() - .5 * th),
150 tw,
151 th);
152
153 p.setFont(font);
154 p.drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, text);
155}
156
157void
158FrequencyCorrectionDialog::findNewSatellites(void)

Calls 1

widthMethod · 0.80

Tested by

no test coverage detected