Results 1 to 2 of 2

Thread: mainwindow menubar setChecked

  1. #1
    Join Date
    Oct 2007
    Posts
    11
    Thanks
    4

    Default mainwindow menubar setChecked

    Hi,

    I would like an Action on a MainWindow menubar that is merely checkable but does not show a menu.

    E.g when in the application example in mainwindow.cpp in createMenus() I add the following:

    Qt Code:
    1. zoomMenu = menuBar()->addAction(tr("&Zoom"));
    2. zoomMenu->setStatusTip(tr("Press then Left Click + rubberband + Richt Click"));
    3. // zoomMenu->setEnabled(FALSE); //works
    4. zoomMenu->setCheckable(TRUE);
    5. zoomMenu->setChecked(TRUE);
    To copy to clipboard, switch view to plain text mode 

    Then the 'Zoom' button shows up on the menubar but it is never checked.

    Anybody knows why?

  2. #2
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: mainwindow menubar setChecked

    I don't know if it is actually possible to add QActions directly to the menu bar in this way. I've tried this in the past, but rendering was kind of messed up (not showing the text of buttons). You might have to extend the QMenuBar class to add that.

    Also, C++ has a bool type for a reason.

Similar Threads

  1. Replies: 1
    Last Post: 11th September 2007, 13:34
  2. Menubar in mainwindow form
    By Draximillian in forum Qt Tools
    Replies: 5
    Last Post: 13th April 2006, 02:26

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.