添加快速访问区域挺简单的,实例如下所示:
void QtRightFuncDemo::createQuickAccessBar()
{
RibbonQuickAccessBar* quickAccessBar = ribbonBar()->quickAccessBar();
QAction* action = quickAccessBar->actionCustomizeButton();
action->setToolTip(tr("quickAccessBar"));
QAction* smallButton = quickAccessBar->addAction(QIcon(":/QtRightFuncDemo/res/print.png"), tr("test2"));
smallButton->setToolTip(tr("test2"));
connect(smallButton, SIGNAL(triggered()), this, SLOT(pressButton()));
quickAccessBar->setActionVisible(smallButton, false);
smallButton = quickAccessBar->addAction(QIcon(":/QtRightFuncDemo/res/print.png"), tr("test3"));
smallButton->setToolTip(tr("test3"));
connect(smallButton, SIGNAL(triggered()), this, SLOT(pressButton()));
quickAccessBar->setActionVisible(smallButton, false);
smallButton = quickAccessBar->addAction(QIcon(":/QtRightFuncDemo/res/print.png"), tr("test4"));
smallButton->setToolTip(tr("test4"));
connect(smallButton, SIGNAL(triggered()), this, SLOT(pressButton()));
smallButton = quickAccessBar->addAction(QIcon(":/QtRightFuncDemo/res/print.png"), tr("test5"));
smallButton->setShortcut(QKeySequence::Undo);
smallButton->setEnabled(false);
smallButton = quickAccessBar->addAction(QIcon(":/QtRightFuncDemo/res/print.png"), tr("test6"));
smallButton->setShortcut(QKeySequence::Redo);
smallButton->setEnabled(false);
quickAccessBar->setVisible(true);
}