SARibbon 2.5.2
SARibbon wiki
载入中...
搜索中...
未找到
SARibbonPanelLayout.h
1#ifndef SARIBBONPANELLAYOUT_H
2#define SARIBBONPANELLAYOUT_H
3#include "SARibbonGlobal.h"
4#include <QLayout>
5#include "SARibbonPanelItem.h"
6class QToolButton;
7class SARibbonPanel;
9
24class SA_RIBBON_EXPORT SARibbonPanelLayout : public QLayout
25{
26 Q_OBJECT
27 friend class SARibbonPanel;
28
29public:
31 explicit SARibbonPanelLayout(QWidget* p = nullptr);
35 SARibbonPanel* ribbonPanel() const;
36
38 void insertAction(int index, QAction* act, SARibbonPanelItem::RowProportion rp = SARibbonPanelItem::None);
39
41 void setOptionAction(QAction* action);
42
44 bool isHaveOptionAction() const;
45
47 SARibbonPanelItem* panelItem(QAction* action) const;
48
50 SARibbonPanelItem* lastItem() const;
51
53 QWidget* lastWidget() const;
54
56 void move(int from, int to);
58 bool isDirty() const;
60 void updateGeomArray();
61
63 int indexByAction(QAction* action) const;
64
66 int panelTitleHeight() const;
67
69 void setPanelTitleHeight(int newTitleHeight);
70
72 bool isEnableShowPanelTitle() const;
73
75 void setEnableShowPanelTitle(bool on);
76
78 int largeButtonHeight() const;
79
81 int panelTitleSpace() const;
82
84 void setPanelTitleSpace(int newTitleSpace);
85
87 SARibbonPanelLabel* panelTitleLabel() const;
88
90 void setToolButtonIconSize(const QSize& smallSize, const QSize& largeSize);
92 QPair< QSize, QSize > toolButtonIconSize() const;
93
95 void setLargeIconSize(const QSize& largeSize);
97 QSize largeIconSize() const;
98
100 void setSmallIconSize(const QSize& largeSize);
102 QSize smallIconSize() const;
103
105 bool isEnableWordWrap() const;
107 qreal buttonMaximumAspectRatio() const;
108
109public:
111 void addItem(QLayoutItem* item) Q_DECL_OVERRIDE;
112
114 QLayoutItem* itemAt(int index) const Q_DECL_OVERRIDE;
115
117 QLayoutItem* takeAt(int index) Q_DECL_OVERRIDE;
118
120 int count() const Q_DECL_OVERRIDE;
121
123 bool isEmpty() const Q_DECL_OVERRIDE;
124
126 void invalidate() Q_DECL_OVERRIDE;
127
129 Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
131 void setGeometry(const QRect& rect) Q_DECL_OVERRIDE;
133 QSize minimumSize() const Q_DECL_OVERRIDE;
135 QSize sizeHint() const Q_DECL_OVERRIDE;
136
137protected:
139 QSize optionActionButtonSize() const;
141 void doLayout();
146 void updateGeomArray(const QRect& setrect);
148 void recalcExpandGeomArray(const QRect& setrect);
150 void setEnableWordWrap(bool on);
152 void setButtonMaximumAspectRatio(qreal fac = 1.4);
153
154private:
156 void columnWidthInfo(int colindex, int& width, int& maximum) const;
157
159 void setPanelTitleLabel(SARibbonPanelLabel* newTitleLabel);
160
161private:
162 QList< SARibbonPanelItem* > mItems;
163 int mColumnCount { 0 };
164 bool mExpandFlag { false };
165 QSize mSizeHint;
166 QSize mSmallToolButtonIconSize { 22, 22 };
167 QSize mLargeToolButtonIconSize { 32, 32 };
168 bool mDirty { true };
169 int mLargeHeight { 0 };
170 int mTitleHeight { 15 };
171 int mTitleSpace { 2 };
172 bool mEnableShowTitle { true };
173 SARibbonPanelLabel* mTitleLabel { nullptr };
174 QRect mTitleLabelGeometry;
175 QToolButton* mOptionActionBtn { nullptr };
176 QRect mOptionActionBtnGeometry;
177 bool mEnableWordWrap { true };
178 qreal mButtonMaximumAspectRatio { 1.4 };
179};
180
181#endif // SARIBBONPANELLAYOUT_H
Definition SARibbonPanelItem.h:25
RowProportion
Definition SARibbonPanelItem.h:37
@ None
Undefined proportion, at this time it will be judged based on expandingDirections,...
Definition SARibbonPanelItem.h:38
Definition SARibbonPanel.h:27
Definition SARibbonPanelLayout.h:25
panel页窗口,panel是ribbon的面板用于承放控件 / Ribbon panel container, used to hold controls
Definition SARibbonPanel.h:100