mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-18 04:27:38 -04:00
Theme Editor: Implemented line scrolling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27344 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d4f4104a4a
commit
13e97cd5f5
5 changed files with 126 additions and 3 deletions
|
@ -24,7 +24,7 @@
|
|||
#include <QPainter>
|
||||
|
||||
RBText::RBText(QImage* image, int maxWidth, QGraphicsItem *parent)
|
||||
:QGraphicsItem(parent), image(image), maxWidth(maxWidth)
|
||||
:QGraphicsItem(parent), image(image), maxWidth(maxWidth), offset(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,13 @@ QRectF RBText::boundingRect() const
|
|||
void RBText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
{
|
||||
/* Making sure the offset is within bounds */
|
||||
if(image->width() > maxWidth)
|
||||
if(offset > image->width() - maxWidth)
|
||||
offset = image->width() - maxWidth;
|
||||
|
||||
if(image->width() < maxWidth)
|
||||
painter->drawImage(0, 0, *image, 0, 0, image->width(), image->height());
|
||||
else
|
||||
painter->drawImage(0, 0, *image, 0, 0, maxWidth, image->height());
|
||||
painter->drawImage(0, 0, *image, offset, 0, maxWidth, image->height());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue