summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor/graphics/rbtext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/graphics/rbtext.cpp')
-rw-r--r--utils/themeeditor/graphics/rbtext.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/utils/themeeditor/graphics/rbtext.cpp b/utils/themeeditor/graphics/rbtext.cpp
index 76b817793e..d7fe542ab1 100644
--- a/utils/themeeditor/graphics/rbtext.cpp
+++ b/utils/themeeditor/graphics/rbtext.cpp
@@ -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());
}