You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.5 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef SARIBBONPANNELITEM_H
#define SARIBBONPANNELITEM_H
#include "SARibbonGlobal.h"
#include <QWidgetItem>
#include <QAction>
class SARibbonToolButton;
/**
* @brief 是对pannel所有子窗口的抽象参考qt的toolbar
*
* 参考qt的toolbarpannel所有子窗口内容都通过QAction进行抽象包括gallery这些窗口也是通过QAction进行抽象
* QAction最终会转换为SARibbonPannelItem每个SARibbonPannelItem都含有一个widgetSARibbonPannel的布局
* 就基于SARibbonPannelItem
*
* 无窗口的action会在内部生成一个SARibbonToolButton
*/
class SA_RIBBON_EXPORT SARibbonPannelItem : public QWidgetItem
{
public:
/**
* @brief 定义了行的占比ribbon中有largemedia和small三种占比
*/
enum RowProportion
{
None, ///< 为定义占比这时候将会依据expandingDirections来判断如果能有Qt::Vertical就等同于Large否则就是Small
Large, ///< 大占比一个widget的高度会充满整个pannel
Medium, ///< 中占比,在@ref SARibbonPannel::pannelLayoutMode 为 @ref SARibbonPannel::ThreeRowMode 时才会起作用且要同一列里两个都是Medium时会在三行中占据两行
Small ///< 小占比占SARibbonPannel的一行Medium在不满足条件时也会变为Small但不会变为Large
};
SARibbonPannelItem(QWidget* widget);
bool isEmpty() const Q_DECL_OVERRIDE;
short rowIndex; ///< 记录当前item属于第几行hide模式下为-1
int columnIndex; ///< 记录当前item属于第几列hide模式下为-1
QRect itemWillSetGeometry; ///< 在调用SARibbonPannelLayout::updateGeomArray会更新这个此处实际设置的时候会QWidgetItem::setGeometry设置Geometry
QAction* action; /// < 记录action参考QToolBarLayoutItem
bool customWidget; ///< 对于没有窗口的action实际也会有一个SARibbonToolButton在销毁时要delete掉
SARibbonPannelItem::RowProportion rowProportion; ///< 行的占比ribbon中有largemedia和small三种占比,见@ref RowProportion
};
#ifndef SA_ActionPropertyName_RowProportion
#define SA_ActionPropertyName_RowProportion "_sa_RowProportion"
#endif
#ifndef SA_ActionPropertyName_ToolButtonPopupMode
#define SA_ActionPropertyName_ToolButtonPopupMode "_sa_ToolButtonPopupMode"
#endif
#ifndef SA_ActionPropertyName_ToolButtonStyle
#define SA_ActionPropertyName_ToolButtonStyle "_sa_ToolButtonStyle"
#endif
#endif // SARIBBONPANNELITEM_H