summaryrefslogtreecommitdiff
path: root/utils/themeeditor/graphics/rbimage.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-08-05 07:28:01 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-08-05 07:28:01 +0000
commitbfc20975b068d707ad46a5f02d8561852e41f311 (patch)
treeb78cab1536f0266617201883cd99d33d022ed07a /utils/themeeditor/graphics/rbimage.cpp
parent430eb651a2c39df6e5af99f4cdb14498fde59363 (diff)
Theme Editor: Fixed image positioning bug, implemented saveGeometry() in RBImage
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27711 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/graphics/rbimage.cpp')
-rw-r--r--utils/themeeditor/graphics/rbimage.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/utils/themeeditor/graphics/rbimage.cpp b/utils/themeeditor/graphics/rbimage.cpp
index 954983eae2..83a564c465 100644
--- a/utils/themeeditor/graphics/rbimage.cpp
+++ b/utils/themeeditor/graphics/rbimage.cpp
@@ -24,10 +24,16 @@
#include <QBitmap>
#include "rbimage.h"
+#include "parsetreenode.h"
-RBImage::RBImage(QString file, int tiles, int x, int y, QGraphicsItem* parent)
- : RBMovable(parent), tiles(tiles), currentTile(0)
+RBImage::RBImage(QString file, int tiles, int x, int y, ParseTreeNode* node,
+ QGraphicsItem* parent)
+ : RBMovable(parent), tiles(tiles), currentTile(0),
+ node(node)
{
+ /* Prevents RBMovable from interfering with initial position setting */
+ setFlag(ItemSendsGeometryChanges, false);
+
if(QFile::exists(file))
{
image = new QPixmap(file);
@@ -56,7 +62,8 @@ RBImage::RBImage(QString file, int tiles, int x, int y, QGraphicsItem* parent)
}
RBImage::RBImage(const RBImage &other, QGraphicsItem* parent)
- : RBMovable(parent), tiles(other.tiles), currentTile(other.currentTile)
+ : RBMovable(parent), tiles(other.tiles), currentTile(other.currentTile),
+ node(other.node)
{
if(other.image)
image = new QPixmap(*(other.image));
@@ -90,7 +97,12 @@ void RBImage::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
RBMovable::paint(painter, option, widget);
}
+
+
void RBImage::saveGeometry()
{
+ QPointF origin = pos();
+ node->modParam(static_cast<int>(origin.x()), 2);
+ node->modParam(static_cast<int>(origin.y()), 3);
}