效果图如下所示:
类似与上图效果所示,代码如下:
RibbonPage* pageHome1 = ribbonBar()->addPage(tr("Home"));
//实现代码:
{
QMenu* menuOptions = ribbonBar()->addMenu(tr("Options"));
QAction* actionStyle = menuOptions->addAction(tr("Style")); QMenu* menuStyle = new QMenu(ribbonBar());
QActionGroup* styleActions = new QActionGroup(this); QAction* actionDefault = menuStyle->addAction(tr("Default"));
actionDefault->setObjectName("Default");
actionDefault->setCheckable(true);
actionDefault->setChecked(true);
styleActions->addAction(actionDefault);
}