diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-08-03 22:29:26 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-08-03 22:29:26 +0000 |
| commit | 83c60a1012f2db6c21c5779f7e11b2f3e479df85 (patch) | |
| tree | c4ceb451457fe34cd0df156d0b9a6ecc593496ac /utils/themeeditor/graphics/rbviewport.cpp | |
| parent | 851be21f671feb0bf41e1dcaaced4d7e2e5cf72c (diff) | |
| download | rockbox-83c60a1012f2db6c21c5779f7e11b2f3e479df85.zip rockbox-83c60a1012f2db6c21c5779f7e11b2f3e479df85.tar.gz rockbox-83c60a1012f2db6c21c5779f7e11b2f3e479df85.tar.bz2 rockbox-83c60a1012f2db6c21c5779f7e11b2f3e479df85.tar.xz | |
Theme Editor: Created the RBMovable abstract class for screen elements that can be moved around, began implementing it and making images, viewports, and album art children of it
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27685 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/graphics/rbviewport.cpp')
| -rw-r--r-- | utils/themeeditor/graphics/rbviewport.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index f7b1bc4..fe17ebb 100644 --- a/utils/themeeditor/graphics/rbviewport.cpp +++ b/utils/themeeditor/graphics/rbviewport.cpp @@ -39,7 +39,7 @@ const double RBViewport::scrollRate = 30; RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) - : QGraphicsItem(info.screen()), foreground(info.screen()->foreground()), + : RBMovable(info.screen()), foreground(info.screen()->foreground()), background(info.screen()->background()), textOffset(0,0), screen(info.screen()), textAlign(Left), showStatusBar(false), statusBarTexture(":/render/statusbar.png"), @@ -178,6 +178,8 @@ void RBViewport::paint(QPainter *painter, if(showStatusBar) painter->fillRect(QRectF(0, 0, size.width(), 8), statusBarTexture); + + RBMovable::paint(painter, option, widget); } void RBViewport::newLine() @@ -297,24 +299,9 @@ void RBViewport::showPlaylist(const RBRenderInfo &info, int start, } } -QVariant RBViewport::itemChange(GraphicsItemChange change, - const QVariant &value) +void RBViewport::saveGeometry() { - if(change == ItemPositionChange) - { - QPointF pos = value.toPointF(); - QRectF bound = parentItem()->boundingRect(); - - pos.setX(qMax(0., pos.x())); - pos.setX(qMin(pos.x(), bound.width() - boundingRect().width())); - - pos.setY(qMax(0., pos.y())); - pos.setY(qMin(pos.y(), bound.height() - boundingRect().height())); - - return pos; - } - return QGraphicsItem::itemChange(change, value); } void RBViewport::alignLeft() |