![]() |
SARibbon 2.5.1
SARibbon wiki
|
panel页窗口,panel是ribbon的面板用于承放控件 / Ribbon panel container, used to hold controls 更多...
#include <SARibbonPanel.h>
类 | |
class | PrivateData |
Public 类型 | |
enum | PanelLayoutMode { ThreeRowMode , TwoRowMode } |
Layout mode for the panel / 面板的布局模式 更多... | |
using | FpRibbonToolButtonIterate = std::function< bool(SARibbonToolButton *) > |
信号 | |
void | actionTriggered (QAction *action) |
等同于QToolBar::actionTriggered | |
void | panelNameChanged (const QString &n) |
Emitted when the panel's name changes / 当面板名称改变时发出 | |
Public 成员函数 | |
SARibbonPanel (QWidget *parent=nullptr) | |
Constructs a SARibbonPanel with the given parent / 使用给定的父对象构造SARibbonPanel | |
SARibbonPanel (const QString &name, QWidget *parent=nullptr) | |
Constructs a SARibbonPanel with a name and the given parent / 使用名称和给定的父对象构造SARibbonPanel | |
void | addAction (QAction *action, SARibbonPanelItem::RowProportion rowProportion) |
Adds an action to the panel / 向面板添加一个action | |
void | addAction (QAction *act, QToolButton::ToolButtonPopupMode popMode, SARibbonPanelItem::RowProportion rowProportion=SARibbonPanelItem::Large) |
Adds an action with a specified popup mode / 添加一个具有指定弹出模式的action | |
void | addLargeAction (QAction *action) |
Adds a large action (occupies full height) / 添加一个大action(占据整个高度) | |
void | addMediumAction (QAction *action) |
Adds a medium action / 添加一个中等action | |
void | addSmallAction (QAction *action) |
Adds a small action / 添加一个小action | |
void | addSmallAction (QAction *action, QToolButton::ToolButtonPopupMode popMode) |
Adds a small action with a specified popup mode / 添加一个具有指定弹出模式的小action | |
void | addLargeAction (QAction *action, QToolButton::ToolButtonPopupMode popMode) |
Adds a large action with a specified popup mode / 添加一个具有指定弹出模式的大action | |
void | addMediumAction (QAction *action, QToolButton::ToolButtonPopupMode popMode) |
Adds a medium action with a specified popup mode / 添加一个具有指定弹出模式的中等action | |
QAction * | addAction (const QString &text, const QIcon &icon, QToolButton::ToolButtonPopupMode popMode, SARibbonPanelItem::RowProportion rowProportion=SARibbonPanelItem::Large) |
Creates and adds a new action / 创建并添加一个新的action | |
void | addMenu (QMenu *menu, SARibbonPanelItem::RowProportion rowProportion, QToolButton::ToolButtonPopupMode popMode=QToolButton::InstantPopup) |
Adds a menu to the panel / 向面板添加一个菜单 | |
void | addLargeMenu (QMenu *menu, QToolButton::ToolButtonPopupMode popMode=QToolButton::InstantPopup) |
Adds a menu as a large button / 以大按钮形式添加一个菜单 | |
void | addMediumMenu (QMenu *menu, QToolButton::ToolButtonPopupMode popMode=QToolButton::InstantPopup) |
Adds a menu as a medium button / 以中按钮形式添加一个菜单 | |
void | addSmallMenu (QMenu *menu, QToolButton::ToolButtonPopupMode popMode=QToolButton::InstantPopup) |
Adds a menu as a small button / 以小按钮形式添加一个菜单 | |
QAction * | addWidget (QWidget *w, SARibbonPanelItem::RowProportion rowProportion) |
Adds a custom widget to the panel / 向面板添加一个自定义窗口部件 | |
QAction * | addSmallWidget (QWidget *w) |
Adds a widget as a small button / 以小按钮形式添加一个窗口部件 | |
QAction * | addMediumWidget (QWidget *w) |
Adds a widget as a medium button / 以中等按钮形式添加一个窗口部件 | |
QAction * | addLargeWidget (QWidget *w) |
Adds a widget as a large button / 以大按钮形式添加一个窗口部件 | |
SARibbonGallery * | addGallery (bool expanding=true) |
Adds a gallery widget to the panel / 向面板添加一个画廊窗口部件 | |
QAction * | addSeparator () |
Adds a separator / 添加一个分隔符 | |
SARibbonToolButton * | actionToRibbonToolButton (QAction *action) |
Retrieves the SARibbonToolButton associated with an action / 获取与action关联的SARibbonToolButton | |
void | setOptionAction (QAction *action) |
Sets the option action for the panel / 为面板设置选项action | |
bool | isHaveOptionAction () const |
Checks if an option action is set / 检查是否设置了选项action | |
QList< SARibbonToolButton * > | ribbonToolButtons () const |
Returns a list of all SARibbonToolButton children / 返回所有SARibbonToolButton子对象的列表 | |
PanelLayoutMode | panelLayoutMode () const |
Gets the current layout mode / 获取当前的布局模式 | |
void | setPanelLayoutMode (PanelLayoutMode mode) |
Sets the panel's layout mode / 设置面板的布局模式 | |
void | resetToolButtonSize () |
重置按钮的尺寸,在布局改变后(尤其高度变更),按钮的尺寸需要手动变更 | |
bool | isTwoRow () const |
void | setExpanding (bool isExpanding=true) |
Sets the panel to expanding mode / 将面板设置为扩展模式 | |
bool | isExpanding () const |
Checks if the panel is in expanding mode / 检查面板是否处于扩展模式 | |
int | titleHeight () const |
Gets the height of the panel's title / 获取面板标题的高度 | |
bool | isEnableShowTitle () const |
Checks if the panel's title is visible / 检查面板标题是否可见 | |
int | actionIndex (QAction *act) const |
Gets the index of an action within the panel / 获取一个action在面板内的索引 | |
void | moveAction (int from, int to) |
Moves an action to a new position / 将一个action移动到新位置 | |
bool | isCanCustomize () const |
Checks if customization is allowed / 检查是否允许自定义 | |
void | setCanCustomize (bool b) |
Sets whether customization is allowed / 设置是否允许自定义 | |
QString | panelName () const |
Gets the panel's name / 获取面板的名称 | |
void | setPanelName (const QString &title) |
Sets the panel's name / 设置面板的名称 | |
int | largeButtonHeight () const |
Gets the height of the large buttons in this panel / 获取此面板中大按钮的高度 | |
const QList< SARibbonPanelItem * > & | ribbonPanelItem () const |
获取布局item | |
SARibbonPanelLayout * | panelLayout () const |
Gets the panel's layout object / 获取面板的布局对象 | |
void | updateItemGeometry () |
Updates the geometry of all items in the panel / 更新面板内所有项目的几何形状 | |
SARibbonCategory * | category () const |
Gets the parent SARibbonCategory / 获取父SARibbonCategory | |
SARibbonBar * | ribbonBar () const |
Gets the top-level SARibbonBar / 获取顶层的SARibbonBar | |
int | spacing () const |
Gets the spacing between elements in the panel / 获取面板内元素之间的间距 | |
void | setToolButtonIconSize (const QSize &s) |
Sets the icon size for all tool buttons in the panel / 设置面板内所有工具按钮的图标尺寸 | |
QSize | toolButtonIconSize () const |
Gets the current default icon size for tool buttons / 获取工具按钮当前的默认图标尺寸 | |
SARibbonToolButton * | lastAddActionButton () |
获取最近添加的按钮 | |
SARibbonPanelLabel * | titleLabel () const |
Gets the title label widget / 获取标题标签窗口部件 | |
bool | isEnableWordWrap () const |
判断panel的文字是否允许换行 | |
qreal | buttonMaximumAspectRatio () const |
按钮最大宽高比,这个系数决定按钮的最大宽度 | |
bool | iterateButton (FpRibbonToolButtonIterate fp) const |
Iterates over all SARibbonToolButton children / 遍历所有SARibbonToolButton子对象 | |
virtual QSize | sizeHint () const Q_DECL_OVERRIDE |
virtual QSize | minimumSizeHint () const Q_DECL_OVERRIDE |
静态 Public 成员函数 | |
static int | panelHeightHint (const QFontMetrics &fm, PanelLayoutMode layMode, int panelTitleHeight) |
Gets the panel's recommended height / 获取面板的推荐高度 | |
static void | setActionRowProportionProperty (QAction *action, SARibbonPanelItem::RowProportion rp) |
Sets the row proportion property for an action / 为一个action设置行占比属性 | |
static SARibbonPanelItem::RowProportion | getActionRowProportionProperty (QAction *action) |
Gets the row proportion property from an action / 从一个action获取行占比属性 | |
static void | setActionToolButtonPopupModeProperty (QAction *action, QToolButton::ToolButtonPopupMode popMode) |
Sets the ToolButtonPopupMode property for an action / 为一个action设置ToolButtonPopupMode属性 | |
static QToolButton::ToolButtonPopupMode | getActionToolButtonPopupModeProperty (QAction *action) |
Gets the ToolButtonPopupMode property from an action / 从一个action获取ToolButtonPopupMode属性 | |
static void | setActionToolButtonStyleProperty (QAction *action, Qt::ToolButtonStyle buttonStyle) |
Sets the ToolButtonStyle property for an action / 为一个action设置ToolButtonStyle属性 | |
static Qt::ToolButtonStyle | getActionToolButtonStyleProperty (QAction *action) |
Gets the ToolButtonStyle property from an action / 从一个action获取ToolButtonStyle属性 | |
Protected 成员函数 | |
virtual void | actionEvent (QActionEvent *e) Q_DECL_OVERRIDE |
Handles action events (add, remove, change) / 处理action事件(添加、移除、更改) | |
virtual void | changeEvent (QEvent *e) Q_DECL_OVERRIDE |
Handles change events (e.g., font change) / 处理更改事件(例如,字体更改) | |
void | setTitleHeight (int h) |
Sets the height of the panel's title / 设置面板标题的高度 | |
void | setSpacing (int n) |
Sets the spacing between elements in the panel / 设置面板内元素之间的间距 | |
void | setEnableShowTitle (bool on) |
Sets whether the panel's title is visible / 设置面板标题是否可见 | |
void | setEnableWordWrap (bool on) |
设置panel的按钮文字允许换行 | |
void | setButtonMaximumAspectRatio (qreal fac=1.4) |
设置按钮最大宽高比,这个系数决定按钮的最大宽度 | |
属性 | |
bool | isCanCustomize |
bool | isExpanding |
QString | panelName |
友元 | |
class | SARibbonBar |
class | SARibbonCategory |
class | SARibbonCategoryPrivate |
class | SARibbonCustomizeWidgetPrivate |
class | SARibbonPanelLayout |
panel页窗口,panel是ribbon的面板用于承放控件 / Ribbon panel container, used to hold controls
The SARibbonPanel
is a core component of the Ribbon interface. It acts as a container for QAction
objects, automatically creating and managing SARibbonToolButton
instances based on the specified layout proportion (Large, Medium, Small). It supports dynamic layout modes (ThreeRowMode, TwoRowMode) and can display an optional title and an option button.
SARibbonPanel
是 Ribbon 界面的核心组件之一。它作为 QAction
对象的容器, 根据指定的布局比例(大、中、小)自动创建和管理 SARibbonToolButton
实例。 它支持动态布局模式(三行模式、两行模式),并可显示可选的标题和选项按钮。
The panel has two layout modes: two-row and three-row.
ribbon的panel分为两行模式和三行模式。
Within a panel, you can use setExpanding to specify horizontal expansion. Recommendation: Only use this if the panel contains expandable widgets (e.g., SARibbonGallery). Otherwise, blank space will be left.
在panel中,可以通过setExpanding 函数指定panel水平扩展。 建议: 仅在面板内包含可扩展控件(如 SARibbonGallery)时使用此函数。 否则,将会留白。
The panel's layout is implemented by SARibbonPanelLayout. To use a custom layout, inherit from SARibbonElementCreateDelegate::createRibbonPanel.
panel的布局通过SARibbonPanelLayout 来实现。 如需自定义布局,请继承 SARibbonElementCreateDelegate::createRibbonPanel 函数。
SARibbonPanel
is a child of SARibbonCategory
, which belongs to SARibbonBar
. Important: Setting properties directly on a standalone SARibbonPanel
is often meaningless. Global properties (like title height, spacing) are managed by SARibbonBar
. Use these functions in SARibbonBar
instead:
panelTitleHeight
isEnableShowPanelTitle
panelSpacing
panelToolButtonIconSize
SARibbonPanel
属于SARibbonCategory
的子对象,SARibbonCategory
又属于SARibbonBar
的对象。 重要: 单独设置一个SARibbonPanel
的属性很多情况是没有意义的。 全局性属性(如标题高度、间距)由SARibbonBar
统一管理。 请改用SARibbonBar
中的以下函数:
panelTitleHeight
isEnableShowPanelTitle
panelSpacing
panelToolButtonIconSize
Layout mode for the panel / 面板的布局模式
|
explicit |
Constructs a SARibbonPanel with the given parent / 使用给定的父对象构造SARibbonPanel
parent | The parent widget / 父窗口部件 |
|
explicit |
Constructs a SARibbonPanel with a name and the given parent / 使用名称和给定的父对象构造SARibbonPanel
name | The panel's display name / 面板的显示名称 |
parent | The parent widget / 父窗口部件 |
|
protectedvirtual |
Handles action events (add, remove, change) / 处理action事件(添加、移除、更改)
This function is called by Qt when actions are added, removed, or changed. It ensures the panel's layout is updated accordingly.
当action被添加、移除或更改时,Qt会调用此函数。它确保面板的布局相应更新。
e | The action event / action事件 |
int SARibbonPanel::actionIndex | ( | QAction * | act | ) | const |
Gets the index of an action within the panel / 获取一个action在面板内的索引
act | The action to find / 要查找的action |
SARibbonToolButton * SARibbonPanel::actionToRibbonToolButton | ( | QAction * | action | ) |
Retrieves the SARibbonToolButton associated with an action / 获取与action关联的SARibbonToolButton
action | The action to query / 要查询的action |
|
signal |
等同于QToolBar::actionTriggered
action |
QAction * SARibbonPanel::addAction | ( | const QString & | text, |
const QIcon & | icon, | ||
QToolButton::ToolButtonPopupMode | popMode, | ||
SARibbonPanelItem::RowProportion | rowProportion = SARibbonPanelItem::Large |
||
) |
Creates and adds a new action / 创建并添加一个新的action
This is a convenience function that creates a new QAction
, sets its properties, and adds it to the panel. The panel will take ownership of the action.
这是一个便捷函数,用于创建一个新的 QAction
,设置其属性,并将其添加到面板。 面板将拥有此action的所有权。
text | The action's text / action的文字 |
icon | The action's icon / action的图标 |
popMode | The button's popup mode / 按钮的弹出模式 |
rp | The action's row proportion / action的行占比 |
void SARibbonPanel::addAction | ( | QAction * | act, |
QToolButton::ToolButtonPopupMode | popMode, | ||
SARibbonPanelItem::RowProportion | rowProportion = SARibbonPanelItem::Large |
||
) |
Adds an action with a specified popup mode / 添加一个具有指定弹出模式的action
act | The action to add / 要添加的action |
popMode | The popup mode for the button / 按钮的弹出模式 |
rp | The row proportion for this action / 此action的行占比 |
void SARibbonPanel::addAction | ( | QAction * | action, |
SARibbonPanelItem::RowProportion | rowProportion | ||
) |
Adds an action to the panel / 向面板添加一个action
This is the primary method for populating the panel. The button created for this action will use the row proportion and popup mode previously set via the static property functions.
这是填充面板的主要方法。为此action创建的按钮将使用之前通过静态属性函数设置的行占比和弹出模式。
action | The action to add / 要添加的action |
rp | The row proportion for this action / 此action的行占比 |
SARibbonGallery * SARibbonPanel::addGallery | ( | bool | expanding = true | ) |
Adds a gallery widget to the panel / 向面板添加一个画廊窗口部件
A gallery is a specialized widget for displaying a collection of items. If expanding
is true, the panel's horizontal size policy will be set to Expanding
.
画廊是一个用于显示项目集合的专用窗口部件。如果 expanding
为true, 面板的水平尺寸策略将被设置为 Expanding
。
expanding | If true, sets the panel's size policy to Expanding / 如果为true,将面板的尺寸策略设置为Expanding |
void SARibbonPanel::addLargeAction | ( | QAction * | action | ) |
Adds a large action (occupies full height) / 添加一个大action(占据整个高度)
action | The action to add / 要添加的action |
void SARibbonPanel::addLargeAction | ( | QAction * | action, |
QToolButton::ToolButtonPopupMode | popMode | ||
) |
Adds a large action with a specified popup mode / 添加一个具有指定弹出模式的大action
action | The action to add / 要添加的action |
popMode | The popup mode for the button / 按钮的弹出模式 |
void SARibbonPanel::addLargeMenu | ( | QMenu * | menu, |
QToolButton::ToolButtonPopupMode | popMode = QToolButton::InstantPopup |
||
) |
Adds a menu as a large button / 以大按钮形式添加一个菜单
menu | The menu to add / 要添加的菜单 |
popMode | The popup mode / 弹出模式 |
QAction * SARibbonPanel::addLargeWidget | ( | QWidget * | w | ) |
Adds a widget as a large button / 以大按钮形式添加一个窗口部件
w | The widget to add / 要添加的窗口部件 |
void SARibbonPanel::addMediumAction | ( | QAction * | action | ) |
Adds a medium action / 添加一个中等action
In ThreeRowMode, a medium action occupies two rows. In TwoRowMode, it is equivalent to a small action.
在三行模式下,中等action占据两行。在两行模式下,它等同于一个小action。
action | The action to add / 要添加的action |
void SARibbonPanel::addMediumAction | ( | QAction * | action, |
QToolButton::ToolButtonPopupMode | popMode | ||
) |
Adds a medium action with a specified popup mode / 添加一个具有指定弹出模式的中等action
action | The action to add / 要添加的action |
popMode | The popup mode for the button / 按钮的弹出模式 |
void SARibbonPanel::addMediumMenu | ( | QMenu * | menu, |
QToolButton::ToolButtonPopupMode | popMode = QToolButton::InstantPopup |
||
) |
Adds a menu as a medium button / 以中按钮形式添加一个菜单
menu | The menu to add / 要添加的菜单 |
popMode | The popup mode / 弹出模式 |
QAction * SARibbonPanel::addMediumWidget | ( | QWidget * | w | ) |
Adds a widget as a medium button / 以中等按钮形式添加一个窗口部件
w | The widget to add / 要添加的窗口部件 |
void SARibbonPanel::addMenu | ( | QMenu * | menu, |
SARibbonPanelItem::RowProportion | rowProportion, | ||
QToolButton::ToolButtonPopupMode | popMode = QToolButton::InstantPopup |
||
) |
Adds a menu to the panel / 向面板添加一个菜单
menu | The menu to add / 要添加的菜单 |
rp | The row proportion for the menu button / 菜单按钮的行占比 |
popMode | The popup mode, defaults to InstantPopup / 弹出模式,默认为InstantPopup |
QAction * SARibbonPanel::addSeparator | ( | ) |
Adds a separator / 添加一个分隔符
void SARibbonPanel::addSmallAction | ( | QAction * | action | ) |
Adds a small action / 添加一个小action
action | The action to add / 要添加的action |
void SARibbonPanel::addSmallAction | ( | QAction * | action, |
QToolButton::ToolButtonPopupMode | popMode | ||
) |
Adds a small action with a specified popup mode / 添加一个具有指定弹出模式的小action
action | The action to add / 要添加的action |
popMode | The popup mode for the button / 按钮的弹出模式 |
void SARibbonPanel::addSmallMenu | ( | QMenu * | menu, |
QToolButton::ToolButtonPopupMode | popMode = QToolButton::InstantPopup |
||
) |
Adds a menu as a small button / 以小按钮形式添加一个菜单
menu | The menu to add / 要添加的菜单 |
popMode | The popup mode / 弹出模式 |
QAction * SARibbonPanel::addSmallWidget | ( | QWidget * | w | ) |
Adds a widget as a small button / 以小按钮形式添加一个窗口部件
w | The widget to add / 要添加的窗口部件 |
QAction * SARibbonPanel::addWidget | ( | QWidget * | w, |
SARibbonPanelItem::RowProportion | rowProportion | ||
) |
Adds a custom widget to the panel / 向面板添加一个自定义窗口部件
The panel will create a QWidgetAction
to manage the widget. The panel does not take ownership of the widget; its lifetime is managed by its parent or the caller.
面板将创建一个 QWidgetAction
来管理此窗口部件。面板不拥有此窗口部件的所有权; 其生命周期由其父对象或调用者管理。
w | The widget to add / 要添加的窗口部件 |
rp | The row proportion for the widget / 窗口部件的行占比 |
qreal SARibbonPanel::buttonMaximumAspectRatio | ( | ) | const |
SARibbonCategory * SARibbonPanel::category | ( | ) | const |
Gets the parent SARibbonCategory / 获取父SARibbonCategory
|
protectedvirtual |
Handles change events (e.g., font change) / 处理更改事件(例如,字体更改)
This function is called when properties like the font change. It propagates the change to child widgets and invalidates the layout.
当字体等属性更改时会调用此函数。它将更改传播到子窗口部件并使布局失效。
e | The change event / 更改事件 |
|
static |
Gets the row proportion property from an action / 从一个action获取行占比属性
action | The action to query / 要查询的action |
|
static |
Gets the ToolButtonPopupMode property from an action / 从一个action获取ToolButtonPopupMode属性
action | The action to query / 要查询的action |
|
static |
Gets the ToolButtonStyle property from an action / 从一个action获取ToolButtonStyle属性
action | The action to query / 要查询的action |
bool SARibbonPanel::isCanCustomize | ( | ) | const |
Checks if customization is allowed / 检查是否允许自定义
bool SARibbonPanel::isEnableShowTitle | ( | ) | const |
Checks if the panel's title is visible / 检查面板标题是否可见
bool SARibbonPanel::isEnableWordWrap | ( | ) | const |
判断panel的文字是否允许换行
bool SARibbonPanel::isExpanding | ( | ) | const |
Checks if the panel is in expanding mode / 检查面板是否处于扩展模式
bool SARibbonPanel::isHaveOptionAction | ( | ) | const |
Checks if an option action is set / 检查是否设置了选项action
bool SARibbonPanel::iterateButton | ( | SARibbonPanel::FpRibbonToolButtonIterate | fp | ) | const |
Iterates over all SARibbonToolButton children / 遍历所有SARibbonToolButton子对象
Executes the provided function pointer for each SARibbonToolButton
. If the function returns false
, iteration stops immediately.
对每个 SARibbonToolButton
执行提供的函数指针。如果函数返回 false
, 迭代将立即停止。
Example:
fp | A function pointer that takes a SARibbonToolButton* and returns a bool / 一个接受SARibbonToolButton*并返回bool的函数指针 |
int SARibbonPanel::largeButtonHeight | ( | ) | const |
Gets the height of the large buttons in this panel / 获取此面板中大按钮的高度
SARibbonToolButton * SARibbonPanel::lastAddActionButton | ( | ) |
获取最近添加的按钮
void SARibbonPanel::moveAction | ( | int | from, |
int | to | ||
) |
Moves an action to a new position / 将一个action移动到新位置
from | The current index of the action / action的当前索引 |
to | The new index for the action / action的新索引 |
|
static |
Gets the panel's recommended height / 获取面板的推荐高度
This is a static helper function used internally for layout calculations.
这是一个用于内部布局计算的静态辅助函数。
fm | The font metrics to use for calculation / 用于计算的字体度量 |
layMode | The layout mode / 布局模式 |
panelTitleHeight | The height of the panel's title / 面板标题的高度 |
SARibbonPanelLayout * SARibbonPanel::panelLayout | ( | ) | const |
Gets the panel's layout object / 获取面板的布局对象
SARibbonPanel::PanelLayoutMode SARibbonPanel::panelLayoutMode | ( | ) | const |
QString SARibbonPanel::panelName | ( | ) | const |
|
signal |
Emitted when the panel's name changes / 当面板名称改变时发出
name | The new name / 新的名称 |
SARibbonBar * SARibbonPanel::ribbonBar | ( | ) | const |
Gets the top-level SARibbonBar / 获取顶层的SARibbonBar
const QList< SARibbonPanelItem * > & SARibbonPanel::ribbonPanelItem | ( | ) | const |
获取布局item
QList< SARibbonToolButton * > SARibbonPanel::ribbonToolButtons | ( | ) | const |
Returns a list of all SARibbonToolButton children / 返回所有SARibbonToolButton子对象的列表
|
static |
Sets the row proportion property for an action / 为一个action设置行占比属性
This property determines how much vertical space the corresponding button will occupy within the panel. It should be set before adding the action to the panel.
此属性决定了对应按钮在面板内占据的垂直空间比例。 应在将action添加到面板之前设置。
action | The action to modify / 要修改的action |
rp | The row proportion (Large, Medium, Small) / 行占比(大、中、小) |
|
static |
Sets the ToolButtonPopupMode property for an action / 为一个action设置ToolButtonPopupMode属性
action | The action to modify / 要修改的action |
popMode | The popup mode (e.g., InstantPopup, MenuButtonPopup) / 弹出模式(例如,InstantPopup, MenuButtonPopup) |
|
static |
Sets the ToolButtonStyle property for an action / 为一个action设置ToolButtonStyle属性
action | The action to modify / 要修改的action |
buttonStyle | The button style (e.g., ToolButtonIconOnly, ToolButtonTextBesideIcon) / 按钮样式(例如,ToolButtonIconOnly, ToolButtonTextBesideIcon) |
|
protected |
设置按钮最大宽高比,这个系数决定按钮的最大宽度
按钮的最大宽度为按钮高度*此系数,例如按钮高度为h,那么按钮最大宽度maxw=h*buttonMaximumAspectRatio 如果在此宽度下文字还无法完全显示,那么按钮将不会继续横向扩展,将使用...替代未完全显示的文字
void SARibbonPanel::setCanCustomize | ( | bool | b | ) |
Sets whether customization is allowed / 设置是否允许自定义
b | If true, customization is allowed / 如果为true,则允许自定义 |
|
protected |
Sets whether the panel's title is visible / 设置面板标题是否可见
This function is typically called by SARibbonBar
and is protected to prevent direct user manipulation.
此函数通常由 SARibbonBar
调用,为防止用户直接操作而设为protected。
on | If true, the title is visible / 如果为true,则标题可见 |
|
protected |
设置panel的按钮文字允许换行
on |
void SARibbonPanel::setExpanding | ( | bool | isExpanding = true | ) |
Sets the panel to expanding mode / 将面板设置为扩展模式
In expanding mode, the panel will try to occupy all available horizontal space in its parent layout.
在扩展模式下,面板将尝试占据其父布局中所有可用的水平空间。
isExpanding | If true, sets the horizontal size policy to Expanding / 如果为true,将水平尺寸策略设置为Expanding |
void SARibbonPanel::setOptionAction | ( | QAction * | action | ) |
Sets the option action for the panel / 为面板设置选项action
The option action is typically displayed as a small button in the panel's title area. Pass nullptr
to remove the current option action.
选项action通常显示在面板标题区域的一个小按钮中。 传入 nullptr
以移除当前的选项action。
action | The option action, or nullptr to remove / 选项action,或传入nullptr以移除 |
void SARibbonPanel::setPanelLayoutMode | ( | SARibbonPanel::PanelLayoutMode | mode | ) |
Sets the panel's layout mode / 设置面板的布局模式
mode | The new layout mode (ThreeRowMode or TwoRowMode) / 新的布局模式(三行模式或两行模式) |
void SARibbonPanel::setPanelName | ( | const QString & | title | ) |
Sets the panel's name / 设置面板的名称
Setting the name will also emit the panelNameChanged
signal.
设置名称还会发出 panelNameChanged
信号。
title | The new name for the panel / 面板的新名称 |
|
protected |
Sets the spacing between elements in the panel / 设置面板内元素之间的间距
This function is typically called by SARibbonBar
and is protected to prevent direct user manipulation.
此函数通常由 SARibbonBar
调用,为防止用户直接操作而设为protected。
n | The new spacing value / 新的间距值 |
|
protected |
Sets the height of the panel's title / 设置面板标题的高度
This function is typically called by SARibbonBar
and is protected to prevent direct user manipulation.
此函数通常由 SARibbonBar
调用,为防止用户直接操作而设为protected。
h | The new title height / 新的标题高度 |
void SARibbonPanel::setToolButtonIconSize | ( | const QSize & | s | ) |
Sets the icon size for all tool buttons in the panel / 设置面板内所有工具按钮的图标尺寸
This sets the default icon size for newly created buttons and updates the icon size for existing buttons.
此函数设置新创建按钮的默认图标尺寸,并更新现有按钮的图标尺寸。
s | The new icon size / 新的图标尺寸 |
int SARibbonPanel::spacing | ( | ) | const |
Gets the spacing between elements in the panel / 获取面板内元素之间的间距
int SARibbonPanel::titleHeight | ( | ) | const |
Gets the height of the panel's title / 获取面板标题的高度
SARibbonPanelLabel * SARibbonPanel::titleLabel | ( | ) | const |
Gets the title label widget / 获取标题标签窗口部件
QSize SARibbonPanel::toolButtonIconSize | ( | ) | const |
Gets the current default icon size for tool buttons / 获取工具按钮当前的默认图标尺寸
void SARibbonPanel::updateItemGeometry | ( | ) |
Updates the geometry of all items in the panel / 更新面板内所有项目的几何形状
This function forces a recalculation of the layout and size hints for all buttons and items.
此函数强制重新计算所有按钮和项目的布局及尺寸提示。