SARibbon 2.5.1
SARibbon wiki
载入中...
搜索中...
未找到
SARibbonCategoryLayout.h
1#ifndef SARIBBONCATEGORYLAYOUT_H
2#define SARIBBONCATEGORYLAYOUT_H
3#include "SARibbonGlobal.h"
4#include <QLayout>
5#include <QList>
6#include <QMap>
7#include "SARibbonCategory.h"
8
9class SARibbonPanel;
12
16class SA_RIBBON_EXPORT SARibbonCategoryLayout : public QLayout
17{
18 Q_OBJECT
19 SA_RIBBON_DECLARE_PRIVATE(SARibbonCategoryLayout)
20public:
21 Q_PROPERTY(int scrollPosition READ scrollPosition WRITE setScrollPosition)
22public:
25
26 SARibbonCategory* ribbonCategory() const;
27
28 virtual void addItem(QLayoutItem* item) override;
29 virtual QLayoutItem* itemAt(int index) const override;
30 virtual QLayoutItem* takeAt(int index) override;
31 SARibbonCategoryLayoutItem* takePanelItem(int index);
32 SARibbonCategoryLayoutItem* takePanelItem(SARibbonPanel* panel);
33 bool takePanel(SARibbonPanel* panel);
34 virtual int count() const override;
35 void setGeometry(const QRect& rect) override;
36 QSize sizeHint() const override;
37 QSize minimumSize() const override;
38 Qt::Orientations expandingDirections() const override;
39 void invalidate() override;
40 // 追加一个panel
41 void addPanel(SARibbonPanel* panel);
42 // 插入一个panel
43 void insertPanel(int index, SARibbonPanel* panel);
44 //
45 QSize categoryContentSize() const;
46 // 更新尺寸
47 void updateGeometryArr();
48
49 // 执行位置调整
50 void doLayout();
51
52 // 返回所有panels
53 QList< SARibbonPanel* > panels() const;
54
55 // 通过obj name获取panel
56 SARibbonPanel* panelByObjectName(const QString& objname) const;
57 // 通过panel name获取panel
58 SARibbonPanel* panelByName(const QString& panelname) const;
59 // 通过索引找到panel,如果超过索引范围,会返回nullptr
60 SARibbonPanel* panelByIndex(int i) const;
61 // 移动panel
62 void movePanel(int from, int to);
63 // panel的数量
64 int panelCount() const;
65 // panel的索引
66 int panelIndex(SARibbonPanel* p) const;
67 // 获取所有的panel
68 QList< SARibbonPanel* > panelList() const;
69 // 执行滚轮事件
70 void scroll(int px);
71 void scrollTo(int targetX);
72 // 带动画的滚动
73 void scrollByAnimate(int px);
74 void scrollToByAnimate(int targetX);
75 // 滚动后的位置
76 int scrollPosition() const;
77 // 设置滚动位置
78 void setScrollPosition(int pos);
79 // 是否在滚动动画中
80 bool isAnimatingScroll() const;
81 // 判断是否有滚动过
82 bool isScrolled() const;
83 // category的总宽度
84 int categoryTotalWidth() const;
85 // 设置Category的对齐方式
86 void setCategoryAlignment(SARibbonAlignment al);
87 SARibbonAlignment categoryAlignment() const;
88 // 设置动画持续时间
89 void setAnimationDuration(int duration);
90 int animationDuration() const;
91private Q_SLOTS:
92 void onLeftScrollButtonClicked();
93 void onRightScrollButtonClicked();
94
95private:
96 void setupAnimateScroll();
97};
98
102class SA_RIBBON_EXPORT SARibbonCategoryLayoutItem : public QWidgetItem
103{
104public:
107 SARibbonSeparatorWidget* separatorWidget;
108 // 把内部的widget转换为panel
109 SARibbonPanel* toPanelWidget();
112};
113#endif // SARIBBONCATEGORYLAYOUT_H
SARibbonCategoryLayoutItem,用于标识SARibbonCategoryLayout的item
Definition SARibbonCategoryLayout.h:103
QRect mWillSetGeometry
panel将要设置的Geometry
Definition SARibbonCategoryLayout.h:110
QRect mWillSetSeparatorGeometry
panel将要设置的Separator的Geometry
Definition SARibbonCategoryLayout.h:111
The SARibbonCategoryLayout class
Definition SARibbonCategoryLayout.h:17
Ribbon控件中的分类选项卡页面(Category)
Definition SARibbonCategory.h:66
panel页窗口,panel是ribbon的面板用于承放控件 / Ribbon panel container, used to hold controls
Definition SARibbonPanel.h:93
用于显示分割线
Definition SARibbonSeparatorWidget.h:11