AppUI: 添加右键菜单 (WIP)
This commit is contained in:
parent
0073169822
commit
7206e73428
|
@ -306,8 +306,22 @@ void NineChessWindow::initialize()
|
|||
QWidget::setWindowFlags(Qt::WindowMaximizeButtonHint |
|
||||
Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
|
||||
#endif // SHOW_MAXIMIZED_ON_LOAD
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
ui.pushButton_option->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
connect(ui.pushButton_option, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ctxMenu(const QPoint &)));
|
||||
#endif /* MOBILE_APP_UI */
|
||||
}
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
void NineChessWindow::ctxMenu(const QPoint &pos)
|
||||
{
|
||||
QMenu *menu = new QMenu;
|
||||
menu->addAction(tr("Test Item"), this, SLOT(on_actionNew_N_triggered()));
|
||||
menu->exec(ui.pushButton_option->mapToGlobal(pos));
|
||||
}
|
||||
#endif /* MOBILE_APP_UI */
|
||||
|
||||
void NineChessWindow::ruleInfo()
|
||||
{
|
||||
int s = game->getStepsLimit();
|
||||
|
|
|
@ -63,6 +63,11 @@ private slots:
|
|||
// 初始化
|
||||
void initialize();
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
// 上下文菜单
|
||||
void ctxMenu(const QPoint &pos);
|
||||
#endif /* MOBILE_APP_UI */
|
||||
|
||||
// 动态增加的菜单栏动作的槽函数
|
||||
void actionRules_triggered();
|
||||
|
||||
|
|
Loading…
Reference in New Issue