SARibbon 2.5.1
SARibbon wiki
载入中...
搜索中...
未找到
SARibbonStackedWidget.h
1#ifndef SARIBBONSTACKEDWIDGET_H
2#define SARIBBONSTACKEDWIDGET_H
3#include <QStackedWidget>
4#include "SARibbonGlobal.h"
5class QHideEvent;
6class QResizeEvent;
7
22class SA_RIBBON_EXPORT SARibbonStackedWidget : public QStackedWidget
23{
24 Q_OBJECT
25 SA_RIBBON_DECLARE_PRIVATE(SARibbonStackedWidget)
26public:
27 Q_PROPERTY(int animationWidgetHeight READ animationWidgetHeight WRITE setAnimationWidgetHeight) // 添加自定义属性
28public:
29 explicit SARibbonStackedWidget(QWidget* parent);
31 // 弹出模式
32 void setPopupMode();
33 bool isPopupMode() const;
34
35 // 正常模式 和普通的stackwidget一样
36 void setNormalMode();
37 bool isNormalMode() const;
38
39 // 在弹出模式下以模态方式运行事件循环
40 void exec();
41
42 // 类似tabbar的moveTab函数,交换两个窗口的index
43 void moveWidget(int from, int to);
44
45 // 是否启用弹出动画
46 void setUseAnimation(bool on);
47 bool isUseAnimation() const;
48
49 // 动画持续时间(毫秒)
50 void setAnimationDuration(int duration);
51 int animationDuration() const;
52
53 // 窗口高度
54 int animationWidgetHeight() const;
55 void setAnimationWidgetHeight(int h);
56
57 // 设置窗口normalGeometry,由于此窗口会有动画,防止动画过程中设置尺寸又被动画覆盖,因此此窗口的尺寸设置使用setNormalSize
58 void setNormalGeometry(const QRect& normalGeometry);
59 QRect normalGeometry() const;
60
61 // 对内部窗口发送布局请求
62 void layoutRequestInnerWidgets();
63Q_SIGNALS:
67 void hidWindow();
68
69protected:
70 void showEvent(QShowEvent* e) override;
71 void hideEvent(QHideEvent* e) override;
72 virtual void resizeEvent(QResizeEvent* e) override;
73 // 同步内部窗口的尺寸
74 void updateInnerWidgetGeometry();
75private Q_SLOTS:
76 // 动画完成槽函数
77 void onAnimationFinished();
78 // 建立动画
79 void setupAnimation();
80};
81
82#endif // SARIBBONSTACKEDWIDGET_H
具有弹出式菜单功能的堆叠窗口部件
Definition SARibbonStackedWidget.h:23
void hidWindow()
隐藏窗口信号