[Qt-interest] Qkey shortcuts
Jason Mobarak
jam-list at vandyke.com
Wed Mar 17 21:19:10 CET 2010
On 3/17/2010 1:48 PM, André Somers wrote:
> Hi,
>
> I am probably missing something, but somehow, the following code does
> not work:
>
> QAction* fullScreen = new QAction(this);
>
> QKeySequence fullScreenSequence("CTRL+F");
>
> fullScreen->setShortcut(fullScreenSequence);
>
> connect(fullScreen,SIGNAL(triggered()), this,
> SLOT(toggleFullScreen()));
>
> The slot toggleFullScreen is not triggered. I don’t get any warnings
> regarding a failed connect, and I am sure the code is executed (it is in
> the constructor of my window).
>
> Perhaps someone else has an idea what might be going wrong?
I'm not sure why this is, but a QAction that's not connected to a widget
(for the sole purpose of implementing a shortcut) doesn't seem to work.
Instead, using a QShortcut and connecting to the activated() signal
seems to work for this purpose.
Hope this helps,
-- Jason
> Thanks,
>
> André
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list