src/document.cpp

changeset 245
a41ccc6924e3
parent 244
065db0753f05
child 250
2837b549e616
--- a/src/document.cpp	Mon Jun 20 22:41:34 2022 +0300
+++ b/src/document.cpp	Mon Jun 20 22:54:13 2022 +0300
@@ -170,6 +170,7 @@
 {
 	const QBrush pointBrush;
 	const QPen pointPen;
+	const QPen textPen;
 	const QPen polygonPen;
 	const QPen badPolygonPen;
 	const QBrush greenPolygonBrush;
@@ -178,16 +179,18 @@
 }
 
 static const Pens brightPens{
-	.pointBrush = {Qt::white},
+	.pointBrush = {Qt::black},
 	.pointPen = {QBrush{Qt::black}, 2.0},
+	.textPen = {Qt::black},
 	.polygonPen = {QBrush{Qt::black}, 2.0, Qt::DashLine},
 	.greenPolygonBrush = {QColor{64, 255, 128, 192}},
 	.redPolygonBrush = {QColor{255, 96, 96, 192}},
 };
 
 static const Pens darkPens{
-	.pointBrush = {Qt::black},
+	.pointBrush = {Qt::white},
 	.pointPen = {QBrush{Qt::white}, 2.0},
+	.textPen = {Qt::white},
 	.polygonPen = {QBrush{Qt::white}, 2.0, Qt::DashLine},
 	.greenPolygonBrush = {QColor{64, 255, 128, 192}},
 	.redPolygonBrush = {QColor{255, 96, 96, 192}},
@@ -195,17 +198,21 @@
 
 void EditTools::overpaint(QPainter* painter)
 {
+	painter->save();
 	const Pens& pens = (this->renderer->isDark() ? darkPens : brightPens);
 	this->renderPreview(painter, &pens);
+	QFont font;
+	font.setBold(true);
 	if (this->worldPosition.has_value())
 	{
 		painter->setRenderHint(QPainter::Antialiasing);
-		painter->setPen(Qt::white);
-		painter->setBrush(Qt::green);
+		painter->setPen(pens.pointPen);
+		painter->setBrush(pens.greenPolygonBrush);
 		const QPointF pos = this->renderer->modelToScreenCoordinates(*this->worldPosition);
 		painter->drawEllipse(pos, 5, 5);
-		painter->drawText(pos + QPointF{5, 5}, vectorToString(*this->worldPosition));
+		drawBorderedText(painter, pos + QPointF{5, 5}, font, vectorToString(*this->worldPosition));
 	}
+	painter->restore();
 }
 
 const std::vector<ModelAction> EditTools::modelActions() const

mercurial