Results 1 to 2 of 2

Thread: Keyboard shortcuts in full screen mode

  1. #1
    Join Date
    Jun 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Keyboard shortcuts in full screen mode

    My application (based on Qt 4.7) supports full screen mode. What I would like to accomplish is to hide all UI elements so that I can use the screen for a "clean" full screen display of video. At the same time, I would like to keep the main menu shortcut keys operational.

    After switching to full screen using QWidget::showFullScreen(), I use ui->menuBar->hide() to hide (amongst others) the main menu. When I run this program under Mac OSX, it works. The menu is no longer displayed, but keyboard shortcuts (like "Command-R" to restart a video stream) keep working.

    Under Windows, however, shortcut keys do not seem to be working while the menu is hidden.

    As an experiment, I tried setting up "manual" QAction objects in my mainwindow, something like:

    reconnectAction = new QAction(this);
    reconnectAction->setShortcuts(tr("Ctrl+R");
    connect(reconnectAction, SIGNAL(triggered()), this, SLOT(reconnect()));

    but a (shortcut to a) QAction does not seem to work while the QAction is not added to some menu. But the catch is that there is no menu while in full screen mode.

    Is there an (official) way to implement keyboard shortcuts in full screen mode (e.g., without a displayed menu).

    Thanks,

    --
    Duco

  2. #2
    Join Date
    Mar 2008
    Location
    Marslev, Denmark
    Posts
    31
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Keyboard shortcuts in full screen mode

    There is a very simple solution to this: Just add the actions to your main window.

    The problem is that when an action is only added to widgets that are hidden or disabled, those actions become disabled as well. So by adding your actions to the main window, they are not disabled, and the shortcuts work.
    Bo Thorsen, Viking Software
    Qt applications on Linux and Windows

Similar Threads

  1. Enumerating all keyboard shortcuts
    By jonks in forum Qt Programming
    Replies: 0
    Last Post: 7th November 2010, 21:59
  2. Replies: 5
    Last Post: 23rd February 2007, 10:23
  3. Open a QMainWindow in full screen mode?
    By probine in forum Qt Programming
    Replies: 7
    Last Post: 29th November 2006, 13:44
  4. dynamic keyboard shortcuts troubles
    By gadnio in forum Qt Programming
    Replies: 1
    Last Post: 16th April 2006, 10:48
  5. Keyboard shortcuts problem.
    By Lemming in forum Qt Programming
    Replies: 4
    Last Post: 5th April 2006, 16:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.