创建组-RibbonGroup

使用实例如下:

1、main中:

#include "QRibbonDemo.h"
#include

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setStyle(new RibbonStyle());
    a.setApplicationName("Ribbon Demo");
    QRibbonDemo w;
    w.show();
    return a.exec();
}
2、QRibbonDemo.h中

#pragma once

#include "QtitanRibbon.h"

class QRibbonDemo : public Qtitan::RibbonMainWindow
{
    Q_OBJECT

public:
    QRibbonDemo(QWidget *parent = Q_NULLPTR);

protected slots:
    void optionClipboard();
};
2、QRibbonDemo.cpp中

#include "QRibbonDemo.h"
#include


QRibbonDemo::QRibbonDemo(QWidget *parent)
    : Qtitan::RibbonMainWindow(parent)
{
    if (Qtitan::RibbonPage* pageHome = ribbonBar()->addPage(tr("&Home")))
    {
        if (Qtitan::RibbonGroup* groupClipboard = pageHome->addGroup(tr("Clipboard")))
        {
            //右下角按钮显示
            groupClipboard->setOptionButtonVisible();
            QAction* act = groupClipboard->getOptionButtonAction();
            act->setText(tr("Clipboard"));
            act->setToolTip(tr("Show the Office clipboard Task Pane"));
            act->setStatusTip(tr("Show the Office clipboard Task Pane"));
            connect(act, SIGNAL(triggered()), this, SLOT(optionClipboard()));
        }
    }

    setMinimumSize(500, 500);
}

void QRibbonDemo::optionClipboard()
{
    QMessageBox messageBox(QMessageBox::Information, windowTitle(),
        QLatin1String(""), QMessageBox::Ok, this);
    messageBox.setInformativeText(QLatin1String("Clipboard dialog."));
    messageBox.exec();
}

运行结果如下:

创建组-RibbonGroup_第1张图片

创建组-RibbonGroup_第2张图片

你可能感兴趣的:(QT,c++,qt,分组,RibbonGroup,Ribbon)