Application Example

#ifndef RIBBONPOPULARPAGE_H
#define RIBBONPOPULARPAGE_H

#include <QWidget>

#include "mainwindow.h"
#include "ui_ribbonpopularpage.h"

class PreviewColor : public QWidget
{
public:
    PreviewColor(QWidget* parent);
    virtual ~PreviewColor();
public:
    const QColor& color() const;
    void setColor(const QColor& color);
protected:
    virtual void paintEvent(QPaintEvent* event);
protected:
    QColor m_color;
private:
    Q_DISABLE_COPY(PreviewColor)
};

class RibbonPopularPage : public QWidget
{
    Q_OBJECT
public:
    explicit RibbonPopularPage(MainWindow* mainWindow, QWidget* parent = Q_NULL);
    virtual ~RibbonPopularPage();
public:
    enum Theme
    {
        DefaultStyle,
        FusionStyle,
        AdobePhotoshopLightGray,
        AdobePhotoshopGray,
        AdobePhotoshopDarkGray,
        AdobePhotoshopBlack,
        Office2007Blue,
        Office2007Black,
        Office2007Silver,
        Office2007Aqua,
        Windows7Scenic,
        Office2010Silver,
        Office2010Blue,
        Office2010Black,
        Office2013White,
        Office2013Gray,
        Office2013Dark,
        Office2016Colorful,
        Office2016White,
        Office2016DarkGray,
        Office2016Black,
    };
protected:
    void setupPage();
    void updateEnabledWidgets();
public Q_SLOTS:
    void currentThemeChanged(int);
    void currentBackgroundChanged(int);
    void showColorDialog();
    void accepted();
protected:
    virtual void showEvent(QShowEvent* event);
private:
    Ui::customizePopularPage m_pageRes;
    PreviewColor* m_previewColor;
    RibbonPopularPage::Theme m_currentThemeId;
    QColor m_accentColor;
    QString m_backgroundName;
    MainWindow* m_mainWindow;
    bool m_wasDisplayed;
private:
    Q_DISABLE_COPY(RibbonPopularPage)
};

#endif // RIBBONPOPULARPAGE_H