From 1e14ae6748f271265dd719ac0766a2da3501a21f Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 17 Mar 2012 15:15:53 +0100 Subject: 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. --- shemov.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'shemov.cpp') diff --git a/shemov.cpp b/shemov.cpp index 8fbceed..77c9a98 100644 --- a/shemov.cpp +++ b/shemov.cpp @@ -619,6 +619,7 @@ void SheMov::createActions(){ // viewer actions mPVToggleA = new QAction(QIcon(":/dick_in_cage.png"), tr("Show/Hide Picture Viewer"), this); mPVToggleA->setCheckable(true); + mPVToggleA->setData(PictureViewer2::HideAction); connect(mPVToggleA, SIGNAL(toggled(bool)), mPicWidget, SLOT(showPicViewer(bool))); mPVToggleA->setChecked(false); mPicWidget->picView()->addAction(mPVToggleA); @@ -644,7 +645,8 @@ void SheMov::createActions(){ mPicWidget->picView()->addAction(pvSep2); mPVSlideA = new QAction(QIcon(":/chastity_belt_with_cuffs.png"), tr("Slide"), this); mPVSlideA->setCheckable(true); - connect(mPVSlideA, SIGNAL(triggered()), mPicWidget->picView()->PV(), SLOT(slide())); + mPVSlideA->setData(PictureViewer2::SlideAction); + connect(mPVSlideA, SIGNAL(toggled(bool)), mPicWidget->picView()->PV(), SLOT(slide(bool))); mPicWidget->picView()->addAction(mPVSlideA); QAction *pv2Sep1 = new QAction(this); pv2Sep1->setSeparator(true); @@ -664,6 +666,7 @@ void SheMov::createActions(){ mPicWidget->setPicViewerAction(mPVToggleA); + mPicWidget->picView()->PV()->initActions(); //don't add actions with checkable(true) unless you know what you're doing! mPicActionGroup = new QActionGroup(this); mPicActionGroup->addAction(mPWDeletePicFromA); -- cgit v1.2.3-70-g09d2