summaryrefslogtreecommitdiffstats
path: root/pictureviewer2.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2012-03-17 15:15:53 +0100
committerArno <am@disconnect.de>2012-03-17 15:15:53 +0100
commit1e14ae6748f271265dd719ac0766a2da3501a21f (patch)
treecf1547eb8a55637a8bf1e9a952ce9d07085e0117 /pictureviewer2.h
parente595a9be49615c45f40c57e8385e9fd76bb394e8 (diff)
downloadSheMov-1e14ae6748f271265dd719ac0766a2da3501a21f.tar.gz
SheMov-1e14ae6748f271265dd719ac0766a2da3501a21f.tar.bz2
SheMov-1e14ae6748f271265dd719ac0766a2da3501a21f.zip
Add keyboard actions to PictureViewer2
Never, ever forget: QVariant() casts to a valid int! Again, this was a tough one, but maybe I shouldn't drink and program. PictureViewer2 reacts to Escape and Space. Escape hides it and stops the slide timer, Space activates the slide timer.
Diffstat (limited to 'pictureviewer2.h')
-rw-r--r--pictureviewer2.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/pictureviewer2.h b/pictureviewer2.h
index 6126930..e18fc18 100644
--- a/pictureviewer2.h
+++ b/pictureviewer2.h
@@ -27,6 +27,7 @@ typedef QList<QList<QVariant> > PicDataList;
class PictureViewer2 : public QGraphicsView {
Q_OBJECT
public:
+ enum AssocActions { SlideAction, HideAction };
explicit PictureViewer2(QWidget *parent = 0);
void addFiles(const PicDataList &files, bool clear = true);
void setFile(const PicData &file);
@@ -35,14 +36,17 @@ class PictureViewer2 : public QGraphicsView {
public slots:
void next();
void previous();
- void slide();
+ void slide(bool);
void readSettings();
void writeSettings();
void shuffle();
+ void initActions();
protected:
virtual void wheelEvent(QWheelEvent *event);
virtual void contextMenuEvent(QContextMenuEvent *e);
+ virtual void keyPressEvent(QKeyEvent *e);
+ virtual void hideEvent(QHideEvent *);
private slots:
void showFile(const PicData &data);
@@ -63,6 +67,8 @@ class PictureViewer2 : public QGraphicsView {
bool mUseGradient;
QColor mBgColor;
QPointF mInfoPos;
+ QAction *mSlideA;
+ QAction *mHideA;
};
class PictureViewer2FileinfoItem : public QGraphicsItem {