SARibbon 2.5.2
SARibbon wiki
载入中...
搜索中...
未找到
SARibbonPanelLayout类 参考

#include <SARibbonPanelLayout.h>

类 SARibbonPanelLayout 继承关系图:

Public 成员函数

 SARibbonPanelLayout (QWidget *p=nullptr)
 Constructor for SARibbonPanelLayout
 
 ~SARibbonPanelLayout ()
 Destructor for SARibbonPanelLayout
 
SARibbonPanelribbonPanel () const
 Gets the SARibbonPanel that owns this layout
 
void insertAction (int index, QAction *act, SARibbonPanelItem::RowProportion rp=SARibbonPanelItem::None)
 Inserts an action at a specific index
 
void setOptionAction (QAction *action)
 Sets the option action for the panel
 
bool isHaveOptionAction () const
 Checks if an option action is set
 
SARibbonPanelItempanelItem (QAction *action) const
 Retrieves the SARibbonPanelItem associated with an action
 
SARibbonPanelItemlastItem () const
 Gets the last item added to the layout
 
QWidget * lastWidget () const
 Gets the widget associated with the last item
 
void move (int from, int to)
 Moves an item from one index to another
 
bool isDirty () const
 Checks if layout needs to be reorganized
 
void updateGeomArray ()
 Updates size
 
int indexByAction (QAction *action) const
 Finds the index of an action in the layout
 
int panelTitleHeight () const
 Gets the height of the panel's title
 
void setPanelTitleHeight (int newTitleHeight)
 Sets the height of the panel's title
 
bool isEnableShowPanelTitle () const
 Checks if the panel's title is enabled for display
 
void setEnableShowPanelTitle (bool on)
 Sets whether the panel's title is enabled for display
 
int largeButtonHeight () const
 Gets the height of large buttons
 
int panelTitleSpace () const
 Gets the spacing between the title and the buttons
 
void setPanelTitleSpace (int newTitleSpace)
 Sets the spacing between the title and the buttons
 
SARibbonPanelLabelpanelTitleLabel () const
 Gets the panel's title label
 
void setToolButtonIconSize (const QSize &smallSize, const QSize &largeSize)
 Sets the default icon size for tool buttons
 
QPair< QSize, QSize > toolButtonIconSize () const
 Gets the default icon size for tool buttons
 
void setLargeIconSize (const QSize &largeSize)
 Large button icon size
 
QSize largeIconSize () const
 Get large icon size
 
void setSmallIconSize (const QSize &largeSize)
 Small button icon size
 
QSize smallIconSize () const
 Get small icon size
 
bool isEnableWordWrap () const
 Check if word wrap is enabled
 
qreal buttonMaximumAspectRatio () const
 Maximum aspect ratio of buttons, this coefficient determines the maximum width of buttons
 
void addItem (QLayoutItem *item) Q_DECL_OVERRIDE
 Adds an item to the layout (SARibbonPanelLayout not supported)
 
QLayoutItem * itemAt (int index) const Q_DECL_OVERRIDE
 QLayout required override functions
 
QLayoutItem * takeAt (int index) Q_DECL_OVERRIDE
 Removes and returns the item at the specified index
 
int count () const Q_DECL_OVERRIDE
 Gets the number of items in the layout
 
bool isEmpty () const Q_DECL_OVERRIDE
 Checks if the layout is empty
 
void invalidate () Q_DECL_OVERRIDE
 Invalidates the layout, marking it as dirty
 
Qt::Orientations expandingDirections () const Q_DECL_OVERRIDE
 Returns the directions in which the layout can expand
 
void setGeometry (const QRect &rect) Q_DECL_OVERRIDE
 Set geometry
 
QSize minimumSize () const Q_DECL_OVERRIDE
 Get minimum size
 
QSize sizeHint () const Q_DECL_OVERRIDE
 Get size hint
 

Protected 成员函数

QSize optionActionButtonSize () const
 Gets the size of the option action button
 
void doLayout ()
 Layout action
 
SARibbonPanelItemcreateItem (QAction *action, SARibbonPanelItem::RowProportion rp=SARibbonPanelItem::None)
 把action转换为item
 
void updateGeomArray (const QRect &setrect)
 Update geometry array
 
void recalcExpandGeomArray (const QRect &setrect)
 Recalculate expansion bar code, this function must be called after updateGeomArray function
 
void setEnableWordWrap (bool on)
 Set text wrap enabled
 
void setButtonMaximumAspectRatio (qreal fac=1.4)
 Set maximum aspect ratio of buttons, this coefficient determines the maximum width of buttons
 

友元

class SARibbonPanel
 

详细描述

成员函数说明

◆ addItem()

void SARibbonPanelLayout::addItem ( QLayoutItem *  item)

Adds an item to the layout (SARibbonPanelLayout not supported)

Adds an item to the layout (not supported) / 向布局添加一个项目(不支持)

This layout only accepts items created from QAction via insertAction. Calling this function directly will result in a warning.

此布局仅接受通过 insertActionQAction 创建的项目。直接调用此函数将导致警告。

参数
itemThe layout item to add / 要添加的布局项目

◆ buttonMaximumAspectRatio()

qreal SARibbonPanelLayout::buttonMaximumAspectRatio ( ) const

Maximum aspect ratio of buttons, this coefficient determines the maximum width of buttons

按钮最大宽高比,这个系数决定按钮的最大宽度

返回
按钮最大宽高比
参见
setButtonMaximumAspectRatio

◆ count()

int SARibbonPanelLayout::count ( ) const

Gets the number of items in the layout

Gets the number of items in the layout / 获取布局中项目的数量

返回
The item count / 项目数量

◆ createItem()

SARibbonPanelItem * SARibbonPanelLayout::createItem ( QAction *  action,
SARibbonPanelItem::RowProportion  rp = SARibbonPanelItem::None 
)
protected

把action转换为item

Convert action to item, for pure Action, this function will create SARibbonToolButton rp is used to tell Layout what kind of window to generate, see SARibbonPanelItem::RowProportion for details

此函数参考QToolBarItem *QToolBarLayout::createItem(QAction *action)

对于普通QAction,此函数会创建SARibbonToolButton,SARibbonToolButton的类型参考SARibbonPanelItem::RowProportion,

参数
action
rp行高占比情况
返回
转换的SARibbonPanelItem
注解
每个SARibbonPanelItem最终都会携带一个widget,传入的是QWidgetAction的话,会直接使用QWidgetAction带的widget, 否则会内部生成一个SARibbonToolButton

◆ doLayout()

void SARibbonPanelLayout::doLayout ( )
protected

Layout action

布局所有action

◆ expandingDirections()

Qt::Orientations SARibbonPanelLayout::expandingDirections ( ) const

Returns the directions in which the layout can expand

Returns the directions in which the layout can expand / 返回布局可以扩展的方向

返回
The expanding directions (always Qt::Horizontal for this layout) / 扩展方向(此布局始终为Qt::Horizontal)

◆ indexByAction()

int SARibbonPanelLayout::indexByAction ( QAction *  action) const

Finds the index of an action in the layout

Finds the index of an action in the layout / 在布局中查找一个action的索引

参数
actionThe action to find / 要查找的action
返回
The index of the action, or -1 if not found / action的索引,如果未找到则返回-1

◆ insertAction()

void SARibbonPanelLayout::insertAction ( int  index,
QAction *  act,
SARibbonPanelItem::RowProportion  rp = SARibbonPanelItem::None 
)

Inserts an action at a specific index

Inserts an action at a specific index / 在指定索引处插入一个action

This is the primary method for adding content to the layout. It creates a SARibbonPanelItem from the QAction and inserts it at the specified position.

这是向布局添加内容的主要方法。它从 QAction 创建一个 SARibbonPanelItem 并将其插入到指定位置。

参数
indexThe index at which to insert the action / 插入action的索引
actThe action to insert / 要插入的action
rpThe row proportion for the action / action的行占比

◆ invalidate()

void SARibbonPanelLayout::invalidate ( )

Invalidates the layout, marking it as dirty

Invalidates the layout, marking it as dirty / 使布局失效,将其标记为“脏”

This forces a recalculation of the layout geometry on the next update.

这会强制在下次更新时重新计算布局几何形状。

◆ isDirty()

bool SARibbonPanelLayout::isDirty ( ) const

Checks if layout needs to be reorganized

判断是否需要重新布局

返回

◆ isEmpty()

bool SARibbonPanelLayout::isEmpty ( ) const

Checks if the layout is empty

Checks if the layout is empty / 检查布局是否为空

返回
true if the layout has no items; otherwise false / 如果布局没有项目则返回true;否则返回false

◆ isEnableShowPanelTitle()

bool SARibbonPanelLayout::isEnableShowPanelTitle ( ) const

Checks if the panel's title is enabled for display

Checks if the panel's title is enabled for display / 检查面板标题是否启用显示

返回
true if the title is enabled; otherwise false / 如果标题启用则返回true;否则返回false
参见
setEnableShowPanelTitle

◆ isEnableWordWrap()

bool SARibbonPanelLayout::isEnableWordWrap ( ) const

Check if word wrap is enabled

是否允许文字换行

返回

◆ isHaveOptionAction()

bool SARibbonPanelLayout::isHaveOptionAction ( ) const

Checks if an option action is set

Checks if an option action is set / 检查是否设置了选项action

返回
true if an option action exists; otherwise false / 如果存在选项action则返回true;否则返回false

◆ itemAt()

QLayoutItem * SARibbonPanelLayout::itemAt ( int  index) const

QLayout required override functions

Retrieves the item at the specified index / 获取指定索引处的项目

参数
indexThe index of the item / 项目的索引
返回
The layout item, or nullptr if index is invalid / 布局项目,如果索引无效则返回nullptr

◆ largeButtonHeight()

int SARibbonPanelLayout::largeButtonHeight ( ) const

Gets the height of large buttons

Gets the height of large buttons / 获取大按钮的高度

返回
The large button height / 大按钮高度

◆ largeIconSize()

QSize SARibbonPanelLayout::largeIconSize ( ) const

Get large icon size

大按钮图标尺寸

返回

◆ lastItem()

SARibbonPanelItem * SARibbonPanelLayout::lastItem ( ) const

Gets the last item added to the layout

Gets the last item added to the layout / 获取最后添加到布局的项目

返回
The last item, or nullptr if the layout is empty / 最后一个项目,如果布局为空则返回nullptr

◆ lastWidget()

QWidget * SARibbonPanelLayout::lastWidget ( ) const

Gets the widget associated with the last item

Gets the widget associated with the last item / 获取与最后一个项目关联的窗口部件

返回
The widget, or nullptr if not found / 窗口部件,如果未找到则返回nullptr

◆ move()

void SARibbonPanelLayout::move ( int  from,
int  to 
)

Moves an item from one index to another

Moves an item from one index to another / 将一个项目从一个索引移动到另一个索引

参数
fromThe current index of the item / 项目的当前索引
toThe new index for the item / 项目的新索引

◆ optionActionButtonSize()

QSize SARibbonPanelLayout::optionActionButtonSize ( ) const
protected

Gets the size of the option action button

Gets the size of the option action button / 获取选项action按钮的尺寸

返回
The button's size / 按钮的尺寸

◆ panelItem()

SARibbonPanelItem * SARibbonPanelLayout::panelItem ( QAction *  action) const

Retrieves the SARibbonPanelItem associated with an action

Retrieves the SARibbonPanelItem associated with an action / 获取与action关联的SARibbonPanelItem

参数
actionThe action to query / 要查询的action
返回
The associated item, or nullptr if not found / 关联的项目,如果未找到则返回nullptr

◆ panelTitleHeight()

int SARibbonPanelLayout::panelTitleHeight ( ) const

Gets the height of the panel's title

Gets the height of the panel's title / 获取面板标题的高度

返回
The current title height / 当前的标题高度
参见
setPanelTitleHeight

◆ panelTitleLabel()

SARibbonPanelLabel * SARibbonPanelLayout::panelTitleLabel ( ) const

Gets the panel's title label

Gets the panel's title label / 获取面板的标题标签

返回
A pointer to the SARibbonPanelLabel / 指向SARibbonPanelLabel的指针

◆ panelTitleSpace()

int SARibbonPanelLayout::panelTitleSpace ( ) const

Gets the spacing between the title and the buttons

Gets the spacing between the title and the buttons / 获取标题与按钮之间的间距

返回
The current spacing value / 当前的间距值
参见
setPanelTitleSpace

◆ recalcExpandGeomArray()

void SARibbonPanelLayout::recalcExpandGeomArray ( const QRect &  setrect)
protected

Recalculate expansion bar code, this function must be called after updateGeomArray function

< 原来的列宽

< 列的最大宽度

< 扩展后列的宽度

◆ ribbonPanel()

SARibbonPanel * SARibbonPanelLayout::ribbonPanel ( ) const

Gets the SARibbonPanel that owns this layout

Gets the SARibbonPanel that owns this layout / 获取拥有此布局的SARibbonPanel

返回
A pointer to the parent SARibbonPanel, or nullptr if not found / 指向父SARibbonPanel的指针,如果未找到则返回nullptr

◆ setButtonMaximumAspectRatio()

void SARibbonPanelLayout::setButtonMaximumAspectRatio ( qreal  fac = 1.4)
protected

Set maximum aspect ratio of buttons, this coefficient determines the maximum width of buttons

设置按钮最大宽高比,这个系数决定按钮的最大宽度

按钮的最大宽度为按钮高度*此系数,例如按钮高度为h,那么按钮最大宽度maxw=h*buttonMaximumAspectRatio 如果在此宽度下文字还无法完全显示,那么按钮将不会继续横向扩展,将使用...替代未完全显示的文字

参见
buttonMaximumAspectRatio
注解
用户不应该调用SARibbonPanelLayout::setButtonMaximumAspectRatio 来设置, 而是调用SARibbonBar::setButtonMaximumAspectRatio 设置宽高比

◆ setEnableShowPanelTitle()

void SARibbonPanelLayout::setEnableShowPanelTitle ( bool  on)

Sets whether the panel's title is enabled for display

Sets whether the panel's title is enabled for display / 设置面板标题是否启用显示

参数
onIf true, the title is enabled / 如果为true,则启用标题
参见
isEnableShowPanelTitle

◆ setEnableWordWrap()

void SARibbonPanelLayout::setEnableWordWrap ( bool  on)
protected

Set text wrap enabled

设置文字允许换行

参数
enableWordWrap

◆ setLargeIconSize()

void SARibbonPanelLayout::setLargeIconSize ( const QSize &  largeSize)

Large button icon size

设置大按钮图标尺寸

参数
largeSize

◆ setOptionAction()

void SARibbonPanelLayout::setOptionAction ( QAction *  action)

Sets the option action for the panel

Sets the option action for the panel / 为面板设置选项action

The option action is displayed as a button in the panel's title area. Pass nullptr to remove the current option action.

选项action显示在面板标题区域的一个按钮中。 传入 nullptr 以移除当前的选项action。

参数
actionThe option action, or nullptr to remove / 选项action,或传入nullptr以移除

◆ setPanelTitleHeight()

void SARibbonPanelLayout::setPanelTitleHeight ( int  newTitleHeight)

Sets the height of the panel's title

Sets the height of the panel's title / 设置面板标题的高度

参数
newTitleHeightThe new title height / 新的标题高度
参见
panelTitleHeight

◆ setPanelTitleSpace()

void SARibbonPanelLayout::setPanelTitleSpace ( int  newTitleSpace)

Sets the spacing between the title and the buttons

Sets the spacing between the title and the buttons / 设置标题与按钮之间的间距

参数
newTitleSpaceThe new spacing value / 新的间距值
参见
panelTitleSpace

◆ setSmallIconSize()

void SARibbonPanelLayout::setSmallIconSize ( const QSize &  largeSize)

Small button icon size

设置小按钮图标尺寸

参数
largeSize

◆ setToolButtonIconSize()

void SARibbonPanelLayout::setToolButtonIconSize ( const QSize &  smallSize,
const QSize &  largeSize 
)

Sets the default icon size for tool buttons

Sets the default icon size for tool buttons / 设置工具按钮的默认图标尺寸

参数
sThe new icon size / 新的图标尺寸
参见
toolButtonIconSize

◆ smallIconSize()

QSize SARibbonPanelLayout::smallIconSize ( ) const

Get small icon size

小按钮图标尺寸

返回

◆ takeAt()

QLayoutItem * SARibbonPanelLayout::takeAt ( int  index)

Removes and returns the item at the specified index

Removes and returns the item at the specified index / 移除并返回指定索引处的项目

参数
indexThe index of the item to remove / 要移除的项目的索引
返回
The removed layout item, or nullptr if index is invalid / 被移除的布局项目,如果索引无效则返回nullptr

◆ toolButtonIconSize()

QPair< QSize, QSize > SARibbonPanelLayout::toolButtonIconSize ( ) const

Gets the default icon size for tool buttons

Gets the default icon size for tool buttons / 获取工具按钮的默认图标尺寸

返回
The current icon size / 当前的图标尺寸
参见
setToolButtonIconSize

◆ updateGeomArray()

void SARibbonPanelLayout::updateGeomArray ( const QRect &  setrect)
protected

Update geometry array

更新尺寸


该类的文档由以下文件生成: