summaryrefslogtreecommitdiff
path: root/utils/themeeditor/graphics/rbtext.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-07 22:25:42 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-07 22:25:42 +0000
commit13e97cd5f5330e5c7f52f243ddee5cdce61edfa6 (patch)
treeee53f022c50fc005665597b4f8146809a053016f /utils/themeeditor/graphics/rbtext.cpp
parentd4f4104a4ab04cbca75dff874e57dbe34002ded7 (diff)
downloadrockbox-13e97cd5f5330e5c7f52f243ddee5cdce61edfa6.tar.gz
rockbox-13e97cd5f5330e5c7f52f243ddee5cdce61edfa6.zip
Theme Editor: Implemented line scrolling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27344 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/graphics/rbtext.cpp')
-rw-r--r--utils/themeeditor/graphics/rbtext.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/themeeditor/graphics/rbtext.cpp b/utils/themeeditor/graphics/rbtext.cpp
index 4666f9ae99..8de5d57897 100644
--- a/utils/themeeditor/graphics/rbtext.cpp
+++ b/utils/themeeditor/graphics/rbtext.cpp
@@ -24,7 +24,7 @@
24#include <QPainter> 24#include <QPainter>
25 25
26RBText::RBText(QImage* image, int maxWidth, QGraphicsItem *parent) 26RBText::RBText(QImage* image, int maxWidth, QGraphicsItem *parent)
27 :QGraphicsItem(parent), image(image), maxWidth(maxWidth) 27 :QGraphicsItem(parent), image(image), maxWidth(maxWidth), offset(0)
28{ 28{
29} 29}
30 30
@@ -39,8 +39,13 @@ QRectF RBText::boundingRect() const
39void RBText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 39void RBText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
40 QWidget *widget) 40 QWidget *widget)
41{ 41{
42 /* Making sure the offset is within bounds */
43 if(image->width() > maxWidth)
44 if(offset > image->width() - maxWidth)
45 offset = image->width() - maxWidth;
46
42 if(image->width() < maxWidth) 47 if(image->width() < maxWidth)
43 painter->drawImage(0, 0, *image, 0, 0, image->width(), image->height()); 48 painter->drawImage(0, 0, *image, 0, 0, image->width(), image->height());
44 else 49 else
45 painter->drawImage(0, 0, *image, 0, 0, maxWidth, image->height()); 50 painter->drawImage(0, 0, *image, offset, 0, maxWidth, image->height());
46} 51}