src/gl/axesprogram.cpp

changeset 245
a41ccc6924e3
parent 234
87ee9824210b
child 259
c27612f0eac0
equal deleted inserted replaced
244:065db0753f05 245:a41ccc6924e3
88 }, 88 },
89 }); 89 });
90 this->shader.bufferData(&data[0], countof(data), sizeof data[0]); 90 this->shader.bufferData(&data[0], countof(data), sizeof data[0]);
91 } 91 }
92 92
93 void drawBorderedText(QPainter* painter, const QPointF& point, const QFont& font, const QString& text)
94 {
95 QPainterPath path;
96 path.addText(point, font, text);
97 painter->save();
98 painter->setBrush(Qt::white);
99 painter->setPen({Qt::black, 0.1 * font.pointSizeF()});
100 painter->drawPath(path);
101 painter->restore();
102 }
103
104 void AxesLayer::overpaint(QPainter* painter) 93 void AxesLayer::overpaint(QPainter* painter)
105 { 94 {
95 painter->save();
106 QFont font; 96 QFont font;
107 font.setStyle(QFont::StyleItalic); 97 font.setStyle(QFont::StyleItalic);
108 font.setBold(true); 98 font.setBold(true);
109 painter->setFont(font); 99 painter->setFont(font);
110 QFontMetrics fontMetrics{font}; 100 QFontMetrics fontMetrics{font};
152 if (intersection.has_value()) 142 if (intersection.has_value())
153 { 143 {
154 renderText(axis.text, *intersection); 144 renderText(axis.text, *intersection);
155 } 145 }
156 } 146 }
147 painter->restore();
157 } 148 }
158 149
159 void AxesLayer::paintGL() 150 void AxesLayer::paintGL()
160 { 151 {
161 glLineWidth(5); 152 glLineWidth(5);

mercurial