diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-08-06 20:53:50 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-08-06 20:53:50 +0000 |
commit | df1ff115f50f77473efeec33bea670388e7e3325 (patch) | |
tree | aeecd16c878d72377b3ce8cb81601869c270552e /utils/themeeditor/graphics | |
parent | 76d1377d0495f92ab10310018f05c11183ddc560 (diff) | |
download | rockbox-df1ff115f50f77473efeec33bea670388e7e3325.tar.gz rockbox-df1ff115f50f77473efeec33bea670388e7e3325.zip |
Theme Editor: Added coordinate display when moving mouse around preview window
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27738 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/graphics')
-rw-r--r-- | utils/themeeditor/graphics/rbscene.cpp | 36 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscene.h | 41 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.cpp | 15 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.h | 3 |
4 files changed, 95 insertions, 0 deletions
diff --git a/utils/themeeditor/graphics/rbscene.cpp b/utils/themeeditor/graphics/rbscene.cpp new file mode 100644 index 0000000000..836abee489 --- /dev/null +++ b/utils/themeeditor/graphics/rbscene.cpp @@ -0,0 +1,36 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2010 Robert Bieber + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include <QGraphicsSceneMouseEvent> + +#include <QDebug> + +#include "rbscene.h" + +RBScene::RBScene(QObject* parent) + : QGraphicsScene(parent) +{ +} + +RBScene::~RBScene() +{ +} + diff --git a/utils/themeeditor/graphics/rbscene.h b/utils/themeeditor/graphics/rbscene.h new file mode 100644 index 0000000000..2c4e0ee193 --- /dev/null +++ b/utils/themeeditor/graphics/rbscene.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2010 Robert Bieber + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef RBSCENE_H +#define RBSCENE_H + +#include <QGraphicsScene> + +class RBScene : public QGraphicsScene +{ + Q_OBJECT + +public: + RBScene(QObject* parent = 0); + ~RBScene(); + + void moveMouse(QString position){ emit mouseMoved(position); } + +signals: + void mouseMoved(QString position); +}; + +#endif // RBSCENE_H diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp index df72d5005b..1b1adc8be4 100644 --- a/utils/themeeditor/graphics/rbscreen.cpp +++ b/utils/themeeditor/graphics/rbscreen.cpp @@ -19,12 +19,15 @@ * ****************************************************************************/ +#include "rbscene.h" #include "rbscreen.h" #include "rbviewport.h" #include "devicestate.h" #include <QPainter> #include <QFile> +#include <QGraphicsSceneHoverEvent> +#include <QGraphicsSceneMouseEvent> RBScreen::RBScreen(const RBRenderInfo& info, bool remote, QGraphicsItem *parent) @@ -32,6 +35,8 @@ RBScreen::RBScreen(const RBRenderInfo& info, bool remote, albumArt(0), customUI(0) { + setAcceptHoverEvents(true); + if(remote) { fullWidth = info.device()->data("remotewidth").toInt(); @@ -265,3 +270,13 @@ QColor RBScreen::stringToColor(QString str, QColor fallback) return retval; } + +void RBScreen::hoverMoveEvent(QGraphicsSceneHoverEvent *event) +{ + RBScene* s = dynamic_cast<RBScene*>(scene()); + QPoint p = event->scenePos().toPoint(); + s->moveMouse("(" + QString::number(p.x()) + ", " + + QString::number(p.y()) + ")"); + + QGraphicsItem::hoverMoveEvent(event); +} diff --git a/utils/themeeditor/graphics/rbscreen.h b/utils/themeeditor/graphics/rbscreen.h index 2903a29585..c9f6ae2dbc 100644 --- a/utils/themeeditor/graphics/rbscreen.h +++ b/utils/themeeditor/graphics/rbscreen.h @@ -88,6 +88,9 @@ public: void breakSBS(); +protected: + void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + private: int width; int height; |