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 add tooltip to (main) menu item ?
Forum Updated to NodeBB v4.3 + New Features

How to add tooltip to (main) menu item ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 265 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    How to add tooltip to (main) menu item ?

    The attached , under construction code , should add
    BluetoothMenu_Terminal->setToolTip(text);
    and it should show up when mouse is above / hovers above selected menu.

    It does not.

    It shows up when the main menu is selected / highlighted and mouse hovers over highlighted submenu.

    Both main menu and its submenus should have its own tool tip.

    Where is my code error ?

    Any help would be appreciated.

    { // Jan3 add menu terminal
                        // Apr2 changed menu text
                        QMenu *BluetoothMenu_Terminal  = menuBar()->addMenu(tr("&Terminal ..."));
                        // tool tip shows up in submenu ???
                        text = " primary parent menu access to terminal and its  sub submenus ";
                        BluetoothMenu_Terminal->setToolTip(text);
                        
                        // primary parent menu access to  sub submenus
                        //QMenu *BluetoothMenu_Terminal_Primary =
                        // submenu ?? ?? wrong deleted
                        // BluetoothMenu_Terminal->addMenu("serial terminal (modigied orignal code ) (index 40 )... ");
                        
                        int MS_Menu_Index = 40;
                        QAction *submenu_array[100];
                        // add submenu "action"
                        submenu_array[MS_Menu_Index] =
                                BluetoothMenu_Terminal->addAction(tr("Basic terminal (orignal code ) (40) "),
                                                                  this, [this,MS_Menu_Index]()->void{menu_slot_indexed(MS_Menu_Index);});
                        submenu_array[MS_Menu_Index]->
                                setCheckable(true);
                        /// add ??
                        submenu_array[MS_Menu_Index]->
                                setCheckable(true);
                        // submenu_array[MS_Menu_Index]
                        text = " Tool tip Basic terminal (orignal code ) (40) ";
                        submenu_array[MS_Menu_Index]->setToolTip(text);
                        
    #ifdef TRACK_INDEX
                        text = Q_FUNC_INFO;
                        text += "  @ line  ";
                        text += QString::number(__LINE__);
                        text += "  TASK    Debug BT serial connnection .. ";
                        //text += QString::number(index);
                        qDebug() << text;// t = " DEBUG serial connection ";
                        
                        
    #endif
                        
                        
                        
                        
                        
                        MS_Menu_Index = 41;
                        submenu_array[MS_Menu_Index] =
                                //QAction *aboutAct_submenu_index_10 =
                                BluetoothMenu_Terminal->addAction(tr("Bluetooth modified terminal (41) "),
                                                                  this, [this,MS_Menu_Index]()->void{menu_slot_indexed(MS_Menu_Index);});
                        submenu_array[MS_Menu_Index]->
                                setCheckable(true);
                        
                        
    #ifdef BYPASS
                        
                        // this is sub submenuU
                        //submenu_array[MS_Menu_Index] =
                        //QAction *aboutAct_submenu_index_10 =
                        BluetoothMenu_Terminal_Primary->addAction(tr("Indexed submenus hcitool dev ...(40) "),
                                                                  this, [this,MS_Menu_Index]()->void{menu_slot_indexed(MS_Menu_Index);});
                        
    #endif
                        
                        
                        
                    }
    
    A 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher moved this topic from Qt Creator and other tools on
    • A Anonymous_Banned275

      How to add tooltip to (main) menu item ?

      The attached , under construction code , should add
      BluetoothMenu_Terminal->setToolTip(text);
      and it should show up when mouse is above / hovers above selected menu.

      It does not.

      It shows up when the main menu is selected / highlighted and mouse hovers over highlighted submenu.

      Both main menu and its submenus should have its own tool tip.

      Where is my code error ?

      Any help would be appreciated.

      { // Jan3 add menu terminal
                          // Apr2 changed menu text
                          QMenu *BluetoothMenu_Terminal  = menuBar()->addMenu(tr("&Terminal ..."));
                          // tool tip shows up in submenu ???
                          text = " primary parent menu access to terminal and its  sub submenus ";
                          BluetoothMenu_Terminal->setToolTip(text);
                          
                          // primary parent menu access to  sub submenus
                          //QMenu *BluetoothMenu_Terminal_Primary =
                          // submenu ?? ?? wrong deleted
                          // BluetoothMenu_Terminal->addMenu("serial terminal (modigied orignal code ) (index 40 )... ");
                          
                          int MS_Menu_Index = 40;
                          QAction *submenu_array[100];
                          // add submenu "action"
                          submenu_array[MS_Menu_Index] =
                                  BluetoothMenu_Terminal->addAction(tr("Basic terminal (orignal code ) (40) "),
                                                                    this, [this,MS_Menu_Index]()->void{menu_slot_indexed(MS_Menu_Index);});
                          submenu_array[MS_Menu_Index]->
                                  setCheckable(true);
                          /// add ??
                          submenu_array[MS_Menu_Index]->
                                  setCheckable(true);
                          // submenu_array[MS_Menu_Index]
                          text = " Tool tip Basic terminal (orignal code ) (40) ";
                          submenu_array[MS_Menu_Index]->setToolTip(text);
                          
      #ifdef TRACK_INDEX
                          text = Q_FUNC_INFO;
                          text += "  @ line  ";
                          text += QString::number(__LINE__);
                          text += "  TASK    Debug BT serial connnection .. ";
                          //text += QString::number(index);
                          qDebug() << text;// t = " DEBUG serial connection ";
                          
                          
      #endif
                          
                          
                          
                          
                          
                          MS_Menu_Index = 41;
                          submenu_array[MS_Menu_Index] =
                                  //QAction *aboutAct_submenu_index_10 =
                                  BluetoothMenu_Terminal->addAction(tr("Bluetooth modified terminal (41) "),
                                                                    this, [this,MS_Menu_Index]()->void{menu_slot_indexed(MS_Menu_Index);});
                          submenu_array[MS_Menu_Index]->
                                  setCheckable(true);
                          
                          
      #ifdef BYPASS
                          
                          // this is sub submenuU
                          //submenu_array[MS_Menu_Index] =
                          //QAction *aboutAct_submenu_index_10 =
                          BluetoothMenu_Terminal_Primary->addAction(tr("Indexed submenus hcitool dev ...(40) "),
                                                                    this, [this,MS_Menu_Index]()->void{menu_slot_indexed(MS_Menu_Index);});
                          
      #endif
                          
                          
                          
                      }
      
      A Offline
      A Offline
      Anonymous_Banned275
      wrote on last edited by
      #2

      @AnneRanch UPDATE
      Adding
      BluetoothMenu_Terminal->setToolTipsVisible(true);

      to main menu code (!)
      makes submenu tool tips work correctly

      I am not convinced if there is a way to make the tool tip work on main menu.
      Hovering on main menu "pulls down " the submenus and that MAY be stopping / masking the main menu tool tip .

      I can check that (theory / guess ) by having menu with NO SUBMENUS....

       QMenu *BluetoothMenu_Terminal  = menuBar()->addMenu(tr("&Terminal ..."));
                          // tool tip shows up in submenu ???
                          text = " primary parent menu access to terminal and its  sub submenus ";
                          BluetoothMenu_Terminal->setToolTip(text);
                          BluetoothMenu_Terminal->setToolTipsVisible(true);
      
      
      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