Menu Panel
About 156 wordsLess than 1 minute
2025-07-17
Introduction
TpMenuPanelWidget Class Menu panel group for displaying operation menus. Supports adding custom child widgets; items are single-select; losing focus clears selections; selected items cannot be unselected.
Usage Example
tpMenuPanelWidget *menuPanelWidget = new TpMenuPanelWidget(vScreen);
connect(menuPanelWidget, onClicked, [=](tpMenuPanelItem *)
{ std::cout << "Menu panel clicked" << std::endl; });
tpMenuPanelItem *panelItem1 = new TpMenuPanelItem();
panelItem1->setIcon(applicationDirPath() + "/蓝牙.png");
panelItem1->setTitle("Bluetooth");
tpOnOffButton *onOffBtn1 = new TpOnOffButton();
onOffBtn1->setFixedSize(45, 24);
panelItem1->setCustomizeWidget(onOffBtn1);
menuPanelWidget->addItem(panelItem1);
tpMenuPanelItem *panelItem2 = new TpMenuPanelItem();
panelItem2->setIcon(applicationDirPath() + "/热点.png");
panelItem2->setTitle("Hotspot");
tpOnOffButton *onOffBtn2 = new TpOnOffButton();
onOffBtn2->setFixedSize(45, 24);
panelItem2->setCustomizeWidget(onOffBtn2);
menuPanelWidget->addItem(panelItem2);
tpMenuPanelItem *panelItem3 = new TpMenuPanelItem();
panelItem3->setIcon(applicationDirPath() + "/以太网.png");
panelItem3->setTitle("Ethernet");
menuPanelWidget->addItem(panelItem3);Demo

Copyright
Copyright Ownership:TinyPiXOS
License under:Attribution-ShareAlike 4.0 International (CC-BY-SA-4.0)
