-
Notifications
You must be signed in to change notification settings - Fork 3
/
RibbonCategoryLayout.h
88 lines (56 loc) · 1.89 KB
/
RibbonCategoryLayout.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// Created by weiwu on 21-5-1.
//
#ifndef RIBBON_RIBBONCATEGORYLAYOUT_H
#define RIBBON_RIBBONCATEGORYLAYOUT_H
#include <QtWidgets/QLayout>
#include "RibbonPannel.h"
#include "RibbonSeparatorWidget.h"
#include "RibbonCategory.h"
class RibbonCategoryLayoutItem;
class RibbonSeparatorWidget;
class RibbonCategoryLayoutPrivate;
class RibbonCategoryLayout : public QLayout {
Q_OBJECT
public:
RibbonCategoryLayout(RibbonCategory *parent);
~RibbonCategoryLayout();
RibbonCategory *ribbonCategory();
virtual void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
virtual QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
virtual QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
RibbonCategoryLayoutItem *takePannelItem(int index);
RibbonCategoryLayoutItem *takePannel(RibbonPannel *pannel);
virtual int count() const Q_DECL_OVERRIDE;
//追加一个pannel
void addPannel(RibbonPannel *pannel);
//插入一个pannel
void insertPannel(int index, RibbonPannel *pannel);
void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
QSize sizeHint() const Q_DECL_OVERRIDE;
QSize minimumSize() const Q_DECL_OVERRIDE;
Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
void invalidate() Q_DECL_OVERRIDE;
//更新尺寸
void updateGeometryArr();
//执行位置调整
void doLayout();
//返回所有pannels
QList<RibbonPannel *> pannels() const;
private slots:
void onLeftScrollButtonClicked();
void onRightScrollButtonClicked();
private:
RibbonCategoryLayoutPrivate *m_d;
};
/**
* RibbonCategoryLayoutItem 用于标识RibbonCategoryLayout的item
*/
class RibbonCategoryLayoutItem : public QWidgetItem {
public:
RibbonCategoryLayoutItem(RibbonPannel *w);
RibbonSeparatorWidget *separatorWidget;
QRect mWillSetGeometry;
QRect mWillSetSeparatorGeometry;
};
#endif //RIBBON_RIBBONCATEGORYLAYOUT_H