PDA

View Full Version : disable/enable shortcut



harakiri
4th May 2007, 14:45
hello,

i have a problem with a menu i created. i want to set a shortcut and disable it until a picture is loaded. the button doesn't work while setEnabled is false, but the shortcut works even if the button is disabled. how can i disable the shortcut too?

Code:

/* zoomInAction entry*/
zoomInAct = new QAction(tr("Zoom &In"), this);
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
zoomInAct->setShortcut(tr("Ctrl++"));
zoomInAct->setEnabled(false);
viewMenu->addAction(zoomInAct);

marcel
4th May 2007, 14:59
Well, this sounds like a bug...
Try using action->blockSignals( true ) while you load the image and blockSignals( false ) when you finished loading the image.

Regards

harakiri
6th May 2007, 10:58
yes that worked
thanks :)