Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to have a QMenu with a single item
Forum Update on Monday, May 27th 2025

How to have a QMenu with a single item

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmenuqmenubar
2 Posts 2 Posters 174 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RoachMan
    wrote on last edited by
    #1

    I need to have a menu that does not have any sub menus i.e. just the top menu
    I have tried this - but the text is truncated and not readable

    void Grab::GrabMenu::addMenuActions()
    {
    	QAction* grabAction = Mind::Utilities::CreateThemeAction(m_parent, m_menuBar->objectName()
    	                                                         , "Grab   "
    	                                                         , "/images/info.png"
    	                                                         , "tp", false);
    
    	m_menuBar->addAction(grabAction);
    
    	connect(grabAction, &QAction::triggered, this, &Grab::GrabMenu::GrabSL);
    }
    
    

    Please can someone show me correct way of doing this

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which version of Qt ?
      On which OS ?
      What is the text that is supposed to be shown ?
      Please provide a minimal compilable example that shows the issue.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved