本文主要是介绍Ribbon 添加快速访问区域,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
添加快速访问区域挺简单的,实例如下所示:
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);
}
这篇关于Ribbon 添加快速访问区域的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!