forked from len0rd/rockbox
Theme Editor: Made all lines of text render as a single graphic, viewport size limits now enforced on text width
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27327 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ce5ee193d4
commit
3214e3710a
6 changed files with 59 additions and 38 deletions
|
@ -23,18 +23,24 @@
|
|||
|
||||
#include <QPainter>
|
||||
|
||||
RBText::RBText(const QImage &image, QGraphicsItem *parent)
|
||||
:QGraphicsItem(parent), image(image)
|
||||
RBText::RBText(const QImage &image, int maxWidth, QGraphicsItem *parent)
|
||||
:QGraphicsItem(parent), image(image), maxWidth(maxWidth)
|
||||
{
|
||||
}
|
||||
|
||||
QRectF RBText::boundingRect() const
|
||||
{
|
||||
return QRectF(0, 0, image.width(), image.height());
|
||||
if(image.width() < maxWidth)
|
||||
return QRectF(0, 0, image.width(), image.height());
|
||||
else
|
||||
return QRectF(0, 0, maxWidth, image.height());
|
||||
}
|
||||
|
||||
void RBText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
{
|
||||
painter->drawImage(0, 0, image, 0, 0, image.width(), image.height());
|
||||
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());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue