RibbonGroup Class

RibbonGroup class implements a group of items that is hosted within RibbonPage. More...

Header: #include <RibbonGroup>
Inherits: QWidget

Properties

Public Functions

RibbonGroup(QWidget *parent = Q_NULL)
RibbonGroup(RibbonPage *page, const QString &title)
virtual ~RibbonGroup() override
QAction *addAction(const QIcon &icon, const QString &text, Qt::ToolButtonStyle style, QMenu *menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup)
QAction *addAction(QAction *action, Qt::ToolButtonStyle style, QMenu *menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup)
void addControl(RibbonControl *control)
QMenu *addMenu(const QIcon &icon, const QString &text, Qt::ToolButtonStyle style = Qt::ToolButtonFollowStyle)
QAction *addSeparator()
QAction *addWidget(QWidget *widget)
QAction *addWidget(const QIcon &icon, const QString &text, QWidget *widget)
QAction *addWidget(const QIcon &icon, const QString &text, bool stretch, QWidget *widget)
void clear()
Qt::Alignment contentAlignment() const
RibbonControl *controlByAction(QAction *action) const
RibbonControl *controlByIndex(int index) const
RibbonWidgetControl *controlByWidget(QWidget *widget) const
int controlCount() const
Qt::Alignment controlsAlignment() const
const QIcon &icon() const
QAction *insertAction(QAction *before, QAction *action, Qt::ToolButtonStyle style, QMenu *menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup)
bool isControlsCentering() const
bool isControlsGrouping() const
bool isOptionButtonVisible() const
bool isReduced() const
QAction *optionButtonAction() const
void remove(QWidget *widget)
void removeControl(RibbonControl *control)
void setContentAlignment(Qt::Alignment alignment)
void setControlsAlignment(Qt::Alignment alignment)
void setControlsCentering(bool enabled = true)
void setControlsGrouping(bool enabled = true)
void setIcon(const QIcon &icon)
void setOptionButtonAction(QAction *action)
void setOptionButtonVisible(bool visible = true)
void setSizeDefinition(const RibbonControlSizeDefinition::GroupSizes &sizeDefinition)
void setSpacing(int spacing)
void setTitle(const QString &title)
void setTitleColor(const QColor &color)
void setTitleElideMode(Qt::TextElideMode mode)
void setTitleFont(const QFont &font)
RibbonControlSizeDefinition::GroupSizes sizeDefinition() const
int spacing() const
const QString &title() const
const QColor &titleColor() const
Qt::TextElideMode titleElideMode() const
const QFont &titleFont() const

Reimplemented Public Functions

virtual QSize sizeHint() const override

Reimplemented Protected Functions

virtual void actionEvent(QActionEvent *event) override
virtual void enterEvent(QEnterEvent *event) override
virtual bool event(QEvent *event) override
virtual void leaveEvent(QEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
virtual void paintEvent(QPaintEvent *event) override

Detailed Description

Property Documentation

contentAlignment : Qt::Alignment

Specifies the alignment of the group content items.

Access functions:

Qt::Alignment contentAlignment() const
void setContentAlignment(Qt::Alignment alignment)

icon : QIcon

Holds the icon for the group title.

Access functions:

const QIcon &icon() const
void setIcon(const QIcon &icon)

optionButtonVisible : bool

Specifies the visibility of the option button for the group. The button is visible by default.

Access functions:

bool isOptionButtonVisible() const
void setOptionButtonVisible(bool visible = true)

[read-only] reduced : const bool

Returns true if the group is in the reduced mode.

Access functions:

bool isReduced() const

sizeDefinition : RibbonControlSizeDefinition::GroupSizes

Sets the definition sizes that supported by the group during resizing the ribbon bar. RibbonControlSizeDefinition::GroupLarge and RibbonControlSizeDefinition::GroupSimplified can't be exclude from the definition, they are exist in any way.

Access functions:

RibbonControlSizeDefinition::GroupSizes sizeDefinition() const
void setSizeDefinition(const RibbonControlSizeDefinition::GroupSizes &sizeDefinition)

See also RibbonControlSizeDefinition.

spacing : int

Holds the spacing between the items inside the group in pixels.

Access functions:

int spacing() const
void setSpacing(int spacing)

title : const QString&

Holds the title of the group.

Access functions:

const QString &title() const
void setTitle(const QString &title)

titleColor : const QColor&

Holds the color that used to render the group title.

Access functions:

const QColor &titleColor() const
void setTitleColor(const QColor &color)

titleElideMode : Qt::TextElideMode

Specifies is how to shorten the group title text if it does not fit in width.

Access functions:

Qt::TextElideMode titleElideMode() const
void setTitleElideMode(Qt::TextElideMode mode)

titleFont : const QFont&

Holds the font that used to render the group title.

Access functions:

const QFont &titleFont() const
void setTitleFont(const QFont &font)

Member Function Documentation

[explicit] RibbonGroup::RibbonGroup(QWidget *parent = Q_NULL)

Constructs RibbonGroup object with the given parent.

[explicit] RibbonGroup::RibbonGroup(RibbonPage *page, const QString &title)

Constructs RibbonGroup object with the given page and title.

[override virtual noexcept] RibbonGroup::~RibbonGroup()

Destructor of the RibbonGroup object.

[override virtual protected] void RibbonGroup::actionEvent(QActionEvent *event)

Reimplements: QWidget::actionEvent(QActionEvent *event).

QAction *RibbonGroup::addAction(const QIcon &icon, const QString &text, Qt::ToolButtonStyle style, QMenu *menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup)

Creates and adds the action to the group with the given icon, text and style. If you specify the parameter menu, then will be constructed a special split button which will allow to cause this menu. Parameter mode defines the mode of the popup emerging.

QAction *RibbonGroup::addAction(QAction *action, Qt::ToolButtonStyle style, QMenu *menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup)

Adds the action to the group with the given parameters style, menu and mode.

void RibbonGroup::addControl(RibbonControl *control)

Adds the ribbon control to the group. In most cases you have to use addAction to create and add ribbon control.

QMenu *RibbonGroup::addMenu(const QIcon &icon, const QString &text, Qt::ToolButtonStyle style = Qt::ToolButtonFollowStyle)

Adds the ribbon button with the given icon and text that holds the QMenu. Note, parameter style can be any value of type Qt::ToolButtonStyle except Qt::ToolButtonFollowStyle. In the case of Qt::ToolButtonFollowStyle will be used Qt::ToolButtonTextUnderIcon instead.

QAction *RibbonGroup::addSeparator()

Adds a separator action to the given group.

QAction *RibbonGroup::addWidget(QWidget *widget)

Adds the widget to the group. As alternative can be created QWidgetAction and added it via addAction method.

QAction *RibbonGroup::addWidget(const QIcon &icon, const QString &text, QWidget *widget)

Overloaded method. Adds the widget to the group with given icon and text. As alternative can be created QWidgetAction and added it via addAction method.

QAction *RibbonGroup::addWidget(const QIcon &icon, const QString &text, bool stretch, QWidget *widget)

Overloaded method. Adds the widget to the group with given icon and text. Parameter stretch specifies a the ability to adjust the ribbon control which corresponds to the widget on the control's column width within the group.

void RibbonGroup::clear()

Removes all ribbon controls from the given group.

Qt::Alignment RibbonGroup::contentAlignment() const

Returns the enum that describes the ribbon control alignment for the control's column within the given group.

Note: Getter function for property contentAlignment.

See also setContentAlignment().

RibbonControl *RibbonGroup::controlByAction(QAction *action) const

Returns the ribbon control by action.

See also controlCount, controlByIndex, and controlByWidget.

RibbonControl *RibbonGroup::controlByIndex(int index) const

Returns the ribbon control by index.

See also controlByWidget, controlByIndex, and controlByAction.

RibbonWidgetControl *RibbonGroup::controlByWidget(QWidget *widget) const

Returns the widget ribbon control by widget.

See also controlCount, controlByIndex, and controlByAction.

int RibbonGroup::controlCount() const

Returns the count of ribbon controls within the group.

See also controlByWidget, controlByIndex, and controlByAction.

Qt::Alignment RibbonGroup::controlsAlignment() const

Returns the alignment of block ribbon controls if width of the all controls is more than minmum width of the group.

See also setControlsAlignment().

[override virtual protected] void RibbonGroup::enterEvent(QEnterEvent *event)

Reimplements: QWidget::enterEvent(QEnterEvent *event).

[override virtual protected] bool RibbonGroup::event(QEvent *event)

Reimplements: QWidget::event(QEvent *event).

const QIcon &RibbonGroup::icon() const

Returns the icon of the group.

Note: Getter function for property icon.

See also setIcon().

QAction *RibbonGroup::insertAction(QAction *before, QAction *action, Qt::ToolButtonStyle style, QMenu *menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup)

Adds action before other action that specified in before argument. In result action's widget will be placed before widget that is associated with action before.

bool RibbonGroup::isControlsCentering() const

Returns the value of the feature controls centering.

bool RibbonGroup::isControlsGrouping() const

Returns the value of the feature grouping controls.

bool RibbonGroup::isOptionButtonVisible() const

Returns the visible state for the option button used in the caption of the group.

Note: Getter function for property optionButtonVisible.

bool RibbonGroup::isReduced() const

Returns true if the group is reduced.

Note: Getter function for property reduced.

[override virtual protected] void RibbonGroup::leaveEvent(QEvent *event)

Reimplements: QWidget::leaveEvent(QEvent *event).

[override virtual protected] void RibbonGroup::mousePressEvent(QMouseEvent *event)

Reimplements: QWidget::mousePressEvent(QMouseEvent *event).

QAction *RibbonGroup::optionButtonAction() const

Returns the pointer to action associated with the option button. Notes: Use this action if you want to initialize tooltips, the text in the status bar (StatusTip), icons or for to define custom events.

See also setOptionButtonAction().

[override virtual protected] void RibbonGroup::paintEvent(QPaintEvent *event)

Reimplements: QWidget::paintEvent(QPaintEvent *event).

void RibbonGroup::remove(QWidget *widget)

Removes ribbon control from the group which corresponds to the widget.

void RibbonGroup::removeControl(RibbonControl *control)

Removes the ribbon control from the group.

void RibbonGroup::setContentAlignment(Qt::Alignment alignment)

Sets the enum that describes the ribbon control alignment for the control's column within the given group.

Note: Setter function for property contentAlignment.

See also contentAlignment().

void RibbonGroup::setControlsAlignment(Qt::Alignment alignment)

Sets the alignment of the block ribbon controls.

See also controlsAlignment().

void RibbonGroup::setControlsCentering(bool enabled = true)

Sets the feature controls centering to enabled.

See also isControlsCentering() and setContentAlignment().

void RibbonGroup::setControlsGrouping(bool enabled = true)

Sets the feature grouping controls to enabled.

See also isControlsGrouping().

void RibbonGroup::setIcon(const QIcon &icon)

Sets the icon for the group.

Note: Setter function for property icon.

See also icon().

void RibbonGroup::setOptionButtonAction(QAction *action)

Sets the given action for the option button of the group. Option button is a small button on the bottom of the group. If action is not set then the option button is not visible.

See also optionButtonAction().

void RibbonGroup::setOptionButtonVisible(bool visible = true)

Sets the visible state for the option button used in the group caption. Notes: Option button is usually used to start the dialogue associated with the group.

Note: Setter function for property optionButtonVisible.

See also isOptionButtonVisible().

void RibbonGroup::setSpacing(int spacing)

Sets the spacing between the items inside the group.

Note: Setter function for property spacing.

See also spacing().

void RibbonGroup::setTitle(const QString &title)

Sets the title for the group.

Note: Setter function for property title.

See also title().

void RibbonGroup::setTitleColor(const QColor &color)

Sets the title color for the group.

Note: Setter function for property titleColor.

See also titleColor().

void RibbonGroup::setTitleElideMode(Qt::TextElideMode mode)

Sets the enum where ellipsis should be added for group title. The mode parameter affects the calculation of the width of the group and can take the following values:

Qt::ElideLeftThe text of the group name has an ellipsis on the left. The width of the group will be equal to the width of the content of the group depending on RibbonControlSizeDefinition::GroupSize.
Qt::ElideRightThe text of the group name has an ellipsis on the right. The width of the group will be equal to the width of the content of the group depending on RibbonControlSizeDefinition::GroupSize.
Qt::ElideMiddleThe text of the group name has an ellipsis on the middle. The width of the group will be equal to the width of the content of the group depending on RibbonControlSizeDefinition::GroupSize.
Qt::ElideNoneThe text of the group name occupies the entire width of the group and does not have ellipses. The group width will be equal to the maximum width of the group content depending on the RibbonControlSizeDefinition::GroupSize or text length.

Note: Setter function for property titleElideMode.

See also titleElideMode().

void RibbonGroup::setTitleFont(const QFont &font)

Sets the title font for the group.

Note: Setter function for property titleFont.

See also titleFont().

[override virtual] QSize RibbonGroup::sizeHint() const

Reimplements an access function for property: QWidget::sizeHint.

Returns the recommended size for RibbonGroup.

int RibbonGroup::spacing() const

Returns the spacing between the items inside the group.

Note: Getter function for property spacing.

See also setSpacing().

const QString &RibbonGroup::title() const

Returns the title of the group.

Note: Getter function for property title.

See also setTitle().

const QColor &RibbonGroup::titleColor() const

Returns the title color of the group.

Note: Getter function for property titleColor.

See also setTitleColor().

Qt::TextElideMode RibbonGroup::titleElideMode() const

Returns the enum where ellipsis should be added for group title.

Note: Getter function for property titleElideMode.

See also setTitleElideMode.

const QFont &RibbonGroup::titleFont() const

Returns the title font of the group.

Note: Getter function for property titleFont.

See also setTitleFont().