QAction *javaAction = new QAction("javaAction", this);
QAction *cppAction = new QAction("CcppAction", this);
QAction *phpAction = new QAction("phpAction", this);
QAction *jsAction = new QAction("jsAction", this);
QAction *javaScript = new QAction("javaScript", this);
QMenu *childMenu = new QMenu();
childMenu->setStyleSheet("QMenu {background-color:#FFFFFF;}QMenu::item{ padding:11px 32px;color:#666666;font-size:12px;}");
//子菜单的 子项
QAction *delfile = new QAction(childMenu);
delfile->setText("delfile");
QAction *delfile2 = new QAction(childMenu);
delfile2->setText("delfile2");
childMenu->addAction(delfile);
childMenu->addAction(delfile2);
// 设置 Action 为可选
javaAction->setCheckable(true);
cppAction->setCheckable(true);
phpAction->setCheckable(true);
jsAction->setCheckable(true);
//javaScript->setCheckable(true);
// 需要单选的 Action 添加到 Action Group
QActionGro
QMenu实现多选效果
最新推荐文章于 2025-03-03 08:59:50 发布