New profile, line thickness of pp-graphs and ruler in Qt5

Lubomir I. Ivanov neolit123 at gmail.com
Tue Mar 18 08:05:14 PDT 2014


On 18 March 2014 16:40, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> On 18 March 2014 16:14, Anton Lundin <glance at acc.umu.se> wrote:
>> I just played around with Qt5 a bit and noticed that the pp-graph lines
>> are way to thick and the ruler line too.
>>
>
> see attached patch. is that a fix for the ruler line?
>

updated with the pp-graph lines.
(had to figure out what the heck is 'pp' in the first place...)

my rough guess is that the base classes for all those lines (polygons)
in Qt5 uses different default QPen width values or there is some sort
of scaling (which is worse).
if this patch doesn't solve it, i have no idea; all looks good on Qt4.

lubomir
--
-------------- next part --------------
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index f42bbef..f255fe1 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -668,11 +668,12 @@ void PartialPressureGasItem::modelDataChanged(const QModelIndex &topLeft, const
 
 void PartialPressureGasItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 {
-	painter->setPen(normalColor);
+	const qreal pWidth = 0.2;
+	painter->setPen(QPen(normalColor, pWidth));
 	painter->drawPolyline(polygon());
 
 	QPolygonF poly;
-	painter->setPen(alertColor);
+	painter->setPen(QPen(alertColor, pWidth));
 	Q_FOREACH(const QPolygonF & poly, alertPolygons)
 		painter->drawPolyline(poly);
 
diff --git a/qt-ui/profile/ruleritem.cpp b/qt-ui/profile/ruleritem.cpp
index 627958e..91bfa7f 100644
--- a/qt-ui/profile/ruleritem.cpp
+++ b/qt-ui/profile/ruleritem.cpp
@@ -77,6 +77,7 @@ RulerItem2::RulerItem2() : source(new RulerNodeItem2()),
 	textItem->setFlag(QGraphicsItem::ItemIgnoresTransformations);
 	textItemBack->setBrush(QColor(0xff, 0xff, 0xff, 190));
 	textItemBack->setPen(QColor(Qt::white));
+	setPen(QPen(QColor(Qt::black), 0.2));
 }
 
 void RulerItem2::recalculate()


More information about the subsurface mailing list