Results 1 to 2 of 2

Thread: Can I change a QMenu to QAction in Qt Creator?

  1. #1
    Join Date
    Feb 2016
    Qt products
    Unix/X11 Windows

    Question Can I change a QMenu to QAction in Qt Creator?


    Within Qt Creator, I don't know how to change a QMenu object to a QAction object.

    From my top menu bar, I would like one object to act as a button instead of a dropdown menu, since there are no submenus for this particular object.

    Reading from various threads, I learned that I need to change my QMenu object to a QAction object.

    I was able to manually edit ui_mainwindow.h and modify it and it works perfectly; but of course, whenever I rebuild from the GUI, I lose my changes.

    Qt Code:
    1. QAction *actionSubmittal_Directory;
    2. actionSubmittal_Directory = new QAction(MainWindow);
    3. actionSubmittal_Directory->setObjectName(QString::fromUtf8("actionSubmittal_Directory"));
    To copy to clipboard, switch view to plain text mode 

    Any suggestions how to change this in the GUI creator itself?


  2. #2
    Join Date
    Jan 2006
    Graz, Austria
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Unix/X11 Windows

    Default Re: Can I change a QMenu to QAction in Qt Creator?

    I think Qt Designer can't place actions into the menu bar.
    But you should be able to do that in code.


  3. The following user says thank you to anda_skoa for this useful post:

    bobbayribs (9th December 2016)

Similar Threads

  1. Accessibility for QAction contained in QMenu
    By AndreiTuicu in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2014, 09:27
  2. Replies: 4
    Last Post: 16th April 2013, 16:30
  3. Getting QMenu of selected QAction
    By snydesc in forum Qt Programming
    Replies: 1
    Last Post: 7th October 2012, 01:26
  4. Can't disable a QAction in QMenu
    By punkypogo in forum Qt Programming
    Replies: 3
    Last Post: 10th August 2010, 15:07
  5. QPushButton QMenu QAction
    By hgedek in forum Newbie
    Replies: 2
    Last Post: 1st November 2007, 13:29

Tags for this Thread


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.