Results 1 to 5 of 5

Thread: How to activate menu bar from my app?

  1. #1
    Join Date
    Dec 2010
    Posts
    28
    Thanks
    6
    Thanked 10 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation How to activate menu bar from my app?

    Hi
    I want make a trick. I am writing kind of text editor, and I want make as much as possible space for editing (like Chrome browser makes maximum space for www page). So I want hide menu for most time. And I want show menu when user press Qt::Key_Alt, then I want activate this menu to mimic standard Qt::Key_Alt behaviour. But suprisingly I can't find function to activate/raise menu!!! I you don't known what I mean: run any application with menu bar, and then hit ALT key, then you will see how menu is activated - I want make the same from c++ code. I was trying send event to menu bar (QEvent::KeyPress with Qt::Key_Alt), but it does not work because I filter events for menu bar, so I get infinite loop. I must filter events for menu bars, because when user again click Alt key then I want hide menu bar.

    So: how to activate menu from my c++ code?

  2. #2
    Join Date
    Aug 2009
    Location
    Greece, Chania
    Posts
    63
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: How to activate menu bar from my app?

    QMenuBar inherites QWidget, so you can just map the shortcut you want to hide() or show().
    Misha R.evolution - High level Debugging IDE

    Programming is about 2 basic principles: KISS and RTFM!!!

  3. #3
    Join Date
    Dec 2010
    Posts
    28
    Thanks
    6
    Thanked 10 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: How to activate menu bar from my app?

    I have no problem with show/hide menu. I have problem with menu activation (after showing).

  4. #4
    Join Date
    Aug 2009
    Location
    Greece, Chania
    Posts
    63
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: How to activate menu bar from my app?

    Ohh...I got it now. I think this is the default behavior (on linux not sure about Windows). I created a project with a class inheriting QMainWindow and by pressing ALT I can access the menu bar.
    Misha R.evolution - High level Debugging IDE

    Programming is about 2 basic principles: KISS and RTFM!!!

  5. #5
    Join Date
    Dec 2010
    Posts
    28
    Thanks
    6
    Thanked 10 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to activate menu bar from my app?

    So far so good! One more hint: I want programicaly simulate the ALT key. I caled this behaviour as "activate menu".

Similar Threads

  1. How I can activate QODBC in Qt4 for windows
    By vcp in forum Qt Programming
    Replies: 6
    Last Post: 2nd July 2010, 07:45
  2. How to activate form buttons in a QWebPage
    By redneon in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2009, 16:58
  3. activate window
    By parmar ranjit in forum Qt Tools
    Replies: 12
    Last Post: 30th April 2008, 08:04
  4. Event - closing/activate window
    By chaimar in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2006, 10:12
  5. How to activate another process?
    By gtthang in forum Qt Programming
    Replies: 6
    Last Post: 3rd February 2006, 08:53

Tags for this Thread

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.