SARibbon 2.5.1
SARibbon wiki
载入中...
搜索中...
未找到
SARibbonGallery.h
1#ifndef SARIBBONGALLERY_H
2#define SARIBBONGALLERY_H
3#include "SARibbonGlobal.h"
4#include <QFrame>
5#include <QToolButton>
6#include "SARibbonGalleryGroup.h"
7#include <QSizeGrip>
8class QLabel;
9class QVBoxLayout;
11
15class SA_RIBBON_EXPORT SARibbonGalleryButton : public QToolButton
16{
17 Q_OBJECT
18public:
19 explicit SARibbonGalleryButton(QWidget* parent = nullptr);
21};
22
44class SA_RIBBON_EXPORT SARibbonGallery : public QFrame
45{
46 Q_OBJECT
47 SA_RIBBON_DECLARE_PRIVATE(SARibbonGallery)
48public:
49 explicit SARibbonGallery(QWidget* parent = nullptr);
50 virtual ~SARibbonGallery();
51 virtual QSize sizeHint() const override;
52 // 添加一个GalleryGroup
53 SARibbonGalleryGroup* addGalleryGroup();
54 // 添加一个GalleryGroup
55 void addGalleryGroup(SARibbonGalleryGroup* group);
56 // 快速添加一组actions
57 SARibbonGalleryGroup* addCategoryActions(const QString& title, QList< QAction* > actions);
58 // 设置当前显示的SARibbonGalleryGroup
59 void setCurrentViewGroup(SARibbonGalleryGroup* group);
60 // 获取当前显示的SARibbonGalleryGroup
61 SARibbonGalleryGroup* currentViewGroup() const;
62 // 获取弹出窗口指针
63 SARibbonGalleryViewport* getPopupViewPort() const;
64
65public:
66 // 设置最右边三个控制按钮的最大宽度(默认15)
67 static void setGalleryButtonMaximumWidth(int w);
68Q_SIGNALS:
74 void triggered(QAction* action);
80 void hovered(QAction* action);
81
82public Q_SLOTS:
83 // 上翻页
84 virtual void pageUp();
85 // 下翻页
86 virtual void pageDown();
87 // 显示更多触发,默认弹出内部管理的SARibbonGalleryViewport,用户可重载此函数实现自定义的弹出
88 virtual void showMoreDetail();
89protected Q_SLOTS:
90 void onItemClicked(const QModelIndex& index);
91 virtual void onTriggered(QAction* action);
92
93private:
94 SARibbonGalleryViewport* ensureGetPopupViewPort();
95
96protected:
97 void resizeEvent(QResizeEvent* event) override;
98 void paintEvent(QPaintEvent* event) override;
99};
100
104class SARibbonGalleryViewport : public QWidget
105{
106 Q_OBJECT
107public:
108 SARibbonGalleryViewport(QWidget* parent);
109 // 添加窗口不带标题
110 void addWidget(QWidget* w);
111 // 添加窗口,带标题
112 void addWidget(QWidget* w, const QString& title);
113 // 通过SARibbonGalleryGroup获取对应的标题,用户可以通过此函数设置QLabel的属性
114 QLabel* titleLabel(QWidget* w);
115 // 移除窗口
116 void removeWidget(QWidget* w);
117public Q_SLOTS:
118 void onTitleChanged(QWidget* w, const QString& title);
119
120private:
121 QVBoxLayout* m_layout;
122 QMap< QWidget*, QLabel* > _widgetToTitleLable;
123};
124
125#endif // SARIBBONGALLERY_H
针对SARibbonGallery控件的按钮
Definition SARibbonGallery.h:16
Gallery的组
Definition SARibbonGalleryGroup.h:59
SARibbonGallery的Viewport class
Definition SARibbonGallery.h:105
void addWidget(QWidget *w)
添加窗口不带标题
Definition SARibbonGallery.cpp:153
QLabel * titleLabel(QWidget *w)
通过SARibbonGalleryGroup获取对应的标题,用户可以通过此函数设置QLabel的属性
Definition SARibbonGallery.cpp:180
void removeWidget(QWidget *w)
移除窗口
Definition SARibbonGallery.cpp:189
void onTitleChanged(QWidget *w, const QString &title)
widget的标题改变
Definition SARibbonGallery.cpp:203
Gallery控件
Definition SARibbonGallery.h:45
void hovered(QAction *action)
转发管理的SARibbonGalleryGroup::hovered
void triggered(QAction *action)
转发管理的SARibbonGalleryGroup::triggered 所有加入SARibbonGallery的action都会被一个QActionGroup管理,...