aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp1
-rw-r--r--qt-ui/profile/divetextitem.cpp18
-rw-r--r--qt-ui/profile/divetextitem.h2
3 files changed, 20 insertions, 1 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index 6eb732139..70be86334 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -164,6 +164,7 @@ void DiveCartesianAxis::updateTicks()
label->setText(textForValue(currValue));
label->setBrush(QBrush(textColor));
label->setBrush(colorForValue(currValue));
+ label->setScale(0.8);
labels.push_back(label);
if (orientation == RightToLeft || orientation == LeftToRight) {
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
diff --git a/qt-ui/profile/divetextitem.cpp b/qt-ui/profile/divetextitem.cpp
index bc19d070a..10116e19f 100644
--- a/qt-ui/profile/divetextitem.cpp
+++ b/qt-ui/profile/divetextitem.cpp
@@ -13,7 +13,8 @@ DiveTextItem::DiveTextItem(QGraphicsItem* parent): QGraphicsItemGroup(parent),
internalAlignFlags(Qt::AlignHCenter | Qt::AlignVCenter),
textBackgroundItem(NULL),
textItem(NULL),
- colorIndex(SAC_DEFAULT)
+ colorIndex(SAC_DEFAULT),
+ scale(1.0)
{
setFlag(ItemIgnoresTransformations);
}
@@ -30,6 +31,11 @@ void DiveTextItem::setBrush(const QBrush& b)
updateText();
}
+void DiveTextItem::setScale(double newscale)
+{
+ scale = newscale;
+}
+
void DiveTextItem::setText(const QString& t)
{
internalText = t;
@@ -43,6 +49,7 @@ const QString& DiveTextItem::text()
void DiveTextItem::updateText()
{
+ double size;
delete textItem;
textItem = NULL;
delete textBackgroundItem;
@@ -52,6 +59,15 @@ void DiveTextItem::updateText()
}
QFont fnt(qApp->font());
+ if ((size = fnt.pixelSize()) > 0) {
+ // set in pixels - so the scale factor may not make a difference if it's too close to 1
+ size *= scale;
+ fnt.setPixelSize(size);
+ } else {
+ size = fnt.pointSizeF();
+ size *= scale;
+ fnt.setPointSizeF(size);
+ }
QFontMetrics fm(fnt);
QPainterPath textPath;
diff --git a/qt-ui/profile/divetextitem.h b/qt-ui/profile/divetextitem.h
index f7a9591ef..e0aa3e9b1 100644
--- a/qt-ui/profile/divetextitem.h
+++ b/qt-ui/profile/divetextitem.h
@@ -15,6 +15,7 @@ public:
DiveTextItem(QGraphicsItem* parent = 0);
void setText(const QString& text);
void setAlignment(int alignFlags);
+ void setScale(double newscale);
void setBrush(const QBrush& brush);
void animatedHide();
void animateMoveTo(qreal x, qreal y);
@@ -27,6 +28,7 @@ private:
QString internalText;
color_indice_t colorIndex;
QBrush brush;
+ double scale;
};
#endif // DIVETEXTITEM_H