Results 1 to 2 of 2

Thread: Fog with QMenu

  1. #1
    Join Date
    Jul 2016
    Posts
    41
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Fog with QMenu

    Hi there!

    I am trying to set Menu on Widget.

    Qt Code:
    1. void Widget::set_menu(QMenuBar * menuBar)
    2. {
    3. qDebug()<<"set menu"<<endl;
    4. QMenu* pmnu = new QMenu("&Menu");
    5. menuBar->addMenu(pmnu);
    6. }
    To copy to clipboard, switch view to plain text mode 

    and call this function in constructor:

    Qt Code:
    1. Widget::Widget(QWidget *parent) :
    2. QWidget(parent),
    3. ui(new Ui::Widget)
    4.  
    5. {
    6. ui->setupUi(this);
    7. set_frame();
    8. set_menu(/*????*/);
    9. }
    To copy to clipboard, switch view to plain text mode 

    What should I call as an argument in set_menu()?
    And am I on the right way?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,396
    Thanks
    37
    Thanked 1,542 Times in 1,493 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Fog with QMenu

    Well, obviously you need to pass a pointer to a QMenuBar, that is what your function expects.
    Have you created one?

    The easiest way to get a menu bar is to derive from QMainWindow though.

    Cheers,
    _

Similar Threads

  1. QMenu
    By Viper666 in forum Qt Programming
    Replies: 3
    Last Post: 6th October 2012, 13:34
  2. QMenu mac
    By migel in forum Newbie
    Replies: 1
    Last Post: 26th September 2011, 19:06
  3. Qmenu
    By deeee in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2010, 01:27
  4. QMenu
    By toki83 in forum Qt Programming
    Replies: 2
    Last Post: 22nd March 2008, 11:17
  5. QMenu Help pls
    By munna in forum Newbie
    Replies: 2
    Last Post: 19th March 2006, 15:36

Tags for this Thread

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.