User Tools

Site Tools


Sidebar

Introduction

* Home

Documentation & help

LibreCAD Community

Help on DokuWiki

Temporary shorcuts

dev:v3:gui_api:menu:main_window

Main Window Menu GUI API Functions

Github Link

 namespace lc::ui::api 

Add Menu


Description

Add a menu to the MenuBar of the Main Window. Menu is an instance of the Menu GUI class. Will not add if another menu of the same label already exists in the menu bar.
Note :- Menu of same label may exist in a menu inside a menu of the menu bar i.e. more than one level away from the menu bar.

  • Menu Name - string
  • Pointer to Menu GUI object - menu gui object

Examples

  •  local menu1 = mainWindow:addMenu("Test") 
  •  local menu1 = gui.Menu("Test")
     mainWindow:addMenu(menu1)

Get Menu


Description

Return pointer to menu of the given name or position present in the menu bar. Returns nullptr if not present.

  • Menu Label - string
  • Menu Position - int (Starting from 0 on the left most menu)

Examples

  •  local menu1 = mainWindow:menuByName("Test") 
  •  local menu2 = mainWindow:menuByPosition(2) 

Remove Menu


Description

Remove menu of the given name or at the given position from the menu bar. Does nothing if menu does not exist in the menu bar.

  • Menu Label - string
  • Menu Position - int (Starting from 0 as the left most menu)

Examples

  •  mainWindow:removeMenu("Test") 
  •  mainWindow:removeMenu(2) 

Find Menu Item


Description

Find and return the first menu item found of the given label/object name present in any of the menus recursively (menu bar as well as menus inside other menus).

  • Menu Item Label - string
  • Menu Item Qt Object Name - string

Examples

  •  local item1 = mainWindow:findMenuItem("Ellipse") 
  •  local item2 = mainWindow:findMenuItemByObjectName("actionNew") 

dev/v3/gui_api/menu/main_window.txt · Last modified: 2020/07/06 14:39 by jedi18