Results 1 to 6 of 6

Thread: Dialogs and MenuBar

  1. #1
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Dialogs and MenuBar

    I don't see any way how to add a menuBar to a QDialog, only to QMainWindow. Is it possible ?

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Dialogs and MenuBar

    no, you can't add a menu bar in a dialog, only QMainWindow can have a menu bar.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Dialogs and MenuBar

    Well, I was just about to try and delete this thread because I did manage to add a toolBar to a dialog, with code.

    Qt Code:
    1. QMenuBar *menuBar = new QMenuBar(this);
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Dialogs and MenuBar

    but it's not right, because QDialog has not a place for a menu bar, but QMainWindow has. maybe it's better yo use QToolButton with menus.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Dialogs and MenuBar

    No, I've written apps like this with other libraries, it works fine.
    QMainWindow is still just a dialog but with some extra functions built on top.
    It threw me when I didn't see how to do this with the designer. I guess they figured most people would not want a menu bar on a dialog.

  6. #6
    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: Dialogs and MenuBar

    A camel can go 14 days without drink,
    I can't!!!

Similar Threads

  1. How to prevent recreation of dialogs
    By yektaayduk in forum Qt Programming
    Replies: 10
    Last Post: 11th November 2007, 15:01
  2. Is it possible to move main menubar down?
    By gfunk in forum Qt Programming
    Replies: 10
    Last Post: 12th September 2006, 23:40

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
  •  
Qt is a trademark of The Qt Company.