Results 1 to 5 of 5

Thread: QDialog and QMenuBar

  1. #1

    Default QDialog and QMenuBar

    How Can is add a QMenuBar Object to a QDialog Object? I know QMainWindow have a method "void setMenuBar ( QMenuBar * menuBar ) " But QDialog Havn't. thx

  2. #2
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QDialog and QMenuBar

    You could embed a QMainWindow in the dialog and add the QMenuBar there.
    There are probably other solutions, too.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDialog and QMenuBar

    Well... Basically it's against the rules of good GUI design to have a menu bar in a dialog, so I suggest you reconsider your decision. But if you insist on having it, you have to add it manually to your dialog and place it in the layout like any other widget.

  4. #4

    Default Re: QDialog and QMenuBar

    well thank every one...i got this problem by manual add in my inherit class.

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QDialog and QMenuBar

    Sorry for late response, but QLayout::setMenuBar() might be useful for this...
    J-P Nurmi

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.