diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-07-01 15:21:01 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-07-02 15:51:10 -0700 |
commit | b68e86a141ae11b4341a3d0134cfeb5efea911f0 (patch) | |
tree | c20793a73db8434d7fc465c42bf29151022b8103 /qt-ui/profilegraphics.h | |
parent | 9d9d516c2623b76fbd17b8395910dbc67c0174c9 (diff) | |
download | subsurface-b68e86a141ae11b4341a3d0134cfeb5efea911f0.tar.gz |
Profile: add white outline to all text
To draw the white outline around profile text we trace a text path
using QPainterPath::addText() and then create a couple of
QGraphicsPathItem objects. One of the objects is outlined using
QPainterPathStroker and is placed at the bottom of a QGraphicsItemGroup
with a white brush. The other object holds the standard colored text
and is placed on top.
Notes:
- possibly quite expensive on older machines
- ProfileGraphicsView::plot_text() now returns a QGraphicsItemGroup
- QGraphicsSimpleTextItem uses a top-left baseline anchor
while QPainterPath::addText() uses a bottom-left baseline
which is a bit mysterious, requires the -3 offset for a match
and is possibly non-portable across fonts and sizes.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profilegraphics.h')
-rw-r--r-- | qt-ui/profilegraphics.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index 6a5413d4f..c3cb4ef73 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -104,7 +104,7 @@ public slots: private: void plot_depth_profile(); - QGraphicsSimpleTextItem* plot_text(text_render_options_t *tro, const QPointF& pos, const QString &text, QGraphicsItem *parent = 0); + QGraphicsItemGroup *plot_text(text_render_options_t *tro, const QPointF& pos, const QString &text, QGraphicsItem *parent = 0); void plot_events(struct divecomputer *dc); void plot_one_event(struct event *event); void plot_temperature_profile(); |