diff options
Diffstat (limited to 'utils/themeeditor/graphics/rbtext.cpp')
-rw-r--r-- | utils/themeeditor/graphics/rbtext.cpp | 14 |
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 @@ | |||
23 | 23 | ||
24 | #include <QPainter> | 24 | #include <QPainter> |
25 | 25 | ||
26 | RBText::RBText(const QImage &image, QGraphicsItem *parent) | 26 | RBText::RBText(const QImage &image, int maxWidth, QGraphicsItem *parent) |
27 | :QGraphicsItem(parent), image(image) | 27 | :QGraphicsItem(parent), image(image), maxWidth(maxWidth) |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | QRectF RBText::boundingRect() const | 31 | QRectF RBText::boundingRect() const |
32 | { | 32 | { |
33 | return QRectF(0, 0, image.width(), image.height()); | 33 | if(image.width() < maxWidth) |
34 | return QRectF(0, 0, image.width(), image.height()); | ||
35 | else | ||
36 | return QRectF(0, 0, maxWidth, image.height()); | ||
34 | } | 37 | } |
35 | 38 | ||
36 | void RBText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, | 39 | void RBText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, |
37 | QWidget *widget) | 40 | QWidget *widget) |
38 | { | 41 | { |
39 | painter->drawImage(0, 0, image, 0, 0, image.width(), image.height()); | 42 | if(image.width() < maxWidth) |
43 | painter->drawImage(0, 0, image, 0, 0, image.width(), image.height()); | ||
44 | else | ||
45 | painter->drawImage(0, 0, image, 0, 0, maxWidth, image.height()); | ||
40 | } | 46 | } |