Results 1 to 5 of 5

Thread: Add QMenuBar into QWidget

  1. #1
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Add QMenuBar into QWidget

    Hi,

    I'm trying to add a QMenuBar in a QWidget but I m lost in a step, I tell you all the work done for the moment:

    I've create a layout in the QWidget called MenuBar
    I promote the layout to QMenuBar and associate this layout to a classe: menuBar.cpp (with header menuBar.h)
    I create those classes.

    What's next?

    PD: I have attached an image which I hope it will help....
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Add QMenuBar into QWidget

    Why don't you use a QMainWindow?
    QMenuBar is designed to be used within it.
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Add QMenuBar into QWidget

    At the beginning of the project, the bar wasn't necessary, but now they told me to do it. So I have a QWidget with all the project in.

  4. #4
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Add QMenuBar into QWidget

    Create a QMainWindow and use your QWidget as centralWidget.
    A camel can go 14 days without drink,
    I can't!!!

  5. #5

    Default Re: Add QMenuBar into QWidget

    Like mcosta said, using QMainWindow is a good choice.
    But if you insisting using QWidget to add menu bar, this post may be helpful to you: Qt QWidget add menu bar

Similar Threads

  1. QMenuBar Updates
    By johnmauer in forum Qt Programming
    Replies: 5
    Last Post: 20th January 2010, 13:35
  2. QMenuBar and QMenu
    By thedoctor in forum Qt Programming
    Replies: 0
    Last Post: 21st December 2009, 21:01
  3. Styling QMenubar???
    By anupamgee in forum Qt Programming
    Replies: 5
    Last Post: 29th April 2009, 10:01
  4. QDialog and QMenuBar
    By lutins in forum General Programming
    Replies: 4
    Last Post: 13th September 2008, 14:39
  5. Center QMenuBar
    By pakulo in forum Qt Programming
    Replies: 2
    Last Post: 16th May 2007, 14:03

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.