现在的位置: 首页 > 综合 > 正文

qt菜单menu 和 cba

2013年09月09日 ⁄ 综合 ⁄ 共 589字 ⁄ 字号 评论关闭

// Create menu
m_menu = new QMenu(this);
m_menu->addAction("Menu item", this, SLOT(menuSlot()));

// Create Options CBA
QAction *optionsAction = new QAction("Options", this);
// Set defined menu into Options button
optionsAction->setMenu(m_menu);
optionsAction->setSoftKeyRole(QAction::PositiveSoftKey);
addAction(optionsAction);
 
// Create Exit CBA
QAction *backSoftKeyAction = new QAction(QString("Exit"), this);
backSoftKeyAction->setSoftKeyRole(QAction::NegativeSoftKey);
// Exit button closes the application
QObject::connect(backSoftKeyAction, SIGNAL(triggered()),
QApplication::instance(), SLOT(quit()));
addAction(backSoftKeyAction);

 

抱歉!评论已关闭.