Qt QMenu之创建以及响应事件

QMenu* menu= new QMenu(); 
			QAction* Action1 = new QAction(menu);
			QAction* Action2 = new QAction(menu);
			QAction* Action3 = new QAction(menu);

			Action1->setText("IDCS_INTELLIGENT_ANALYSIS_WELCOME_GUEST");
			Action2->setText("IDCS_FACE_ATTEND");
			Action3->setText("IDCS_INTELLIGENT_ANALYSIS");

			menu->addAction(Action1);
			menu->addAction(Action2);
			menu->addAction(Action3);
			menu->setStyleSheet("QMenu {margin:0px;border: 1px solid rgb(0,0,0);} \
								QMenu::item {height:30px;color: rgb(255,255,255);padding: 0px 20px 0px 20px;background-color: rgb(0,0,0);} \
								QMenu::item:selected {color: rgb(97,96,96);background-color: rgb(232,188,7); } \
								QMenu::item:pressed {background-color: rgb(160,205,220);}\
								QMenu::separator {height: 1px;background: rgb(232,188,7);}");

			m_btnDetail->setMenu(menu);
			connect(Action1, SIGNAL(triggered()), this, SLOT(slot_ClickMenu1()));
			connect(Action2, SIGNAL(triggered()), this, SLOT(slot_ClickMenu2()));
			connect(Action3, SIGNAL(triggered()), this, SLOT(slot_ClickMenu3()));

 

你可能感兴趣的:(Qt)