Results 1 to 4 of 4

Thread: QMenuBar size policy

  1. #1
    Join Date
    Jan 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QMenuBar size policy

    Hellow All!

    I use QMainWindow and menuBar() member.
    Also I use adjustSize() for my MainWindow!!!
    After compile and run I get TWO menubars (probably because of adjustSize()):
    ---------------------
    | File | Edit | View |
    ---------------------
    | Tools | Help |
    -----------------

    But I want to get ONE menubar, i.e.
    -------------------------------------
    | File | Edit | View | Tools | Help |
    -------------------------------------

    How to implement it?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMenuBar size policy

    can you show the code in which you set your menubar?

  3. #3
    Join Date
    Jan 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMenuBar size policy

    void MainWindow::createMenus()
    {
    // Only register menus (without actions)
    menus_["file"] = menuBar()->addMenu(tr("File"));
    menus_["view"] = menuBar()->addMenu(tr("View"));
    menus_["edit"] = menuBar()->addMenu(tr("Edit"));
    menus_["tools"] = menuBar()->addMenu(tr("Tools"));
    menus_["help"] = menuBar()->addMenu(tr("Help"));
    }

    menus_ - is std::map<const std::string,QMenu*>

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMenuBar size policy

    why do you use adjustSize()? (and where? its not in the code you supplied)
    Try not using it, see if it helps.
    I don't see anything wrong with code you posted.

Similar Threads

  1. Problem with Size Policy of derived QWidget
    By eehmke in forum Qt Programming
    Replies: 6
    Last Post: 12th November 2008, 13:43
  2. Size Policy Problem
    By SenSej in forum Newbie
    Replies: 0
    Last Post: 28th October 2008, 14:13
  3. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 17:57
  4. QMenuBar minimum size
    By Angelo Moriconi in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2007, 21:14
  5. QScrollView size policy?
    By Henrikas[MI] in forum Qt Programming
    Replies: 1
    Last Post: 19th November 2006, 10:52

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.