NDEVR
API Documentation
RibbonGroup

Represents the "Tab" of a widget. More...

Inheritance diagram for RibbonGroup:
[legend]
Collaboration diagram for RibbonGroup:
[legend]

Public Member Functions

 RibbonGroup (QWidget *parent=nullptr)
 Constructs a ribbon group widget.
RibbonSubGroupaddSubGroup (const TranslatedString &sub_group_name)
 Adds a new sub-group with the given name.
void addSubGroup (QWidget *sub_group)
 Adds an existing widget as a sub-group.
void adjustButtonsToFit (int primary, int secondary)
 Adjusts button sizes and states to fit within the given dimensions.
void cleanupEmpty ()
 Removes any empty sub-groups.
int currentPrimaryDimension () const
 Returns the current size along the primary layout axis (width or height).
int currentSecondaryDimension () const
 Returns the current size along the secondary layout axis.
bool hasSubGroup (const TranslatedString &sub_group) const
 Checks whether a sub-group with the given name exists.
bool isEmpty () const
 Returns whether this ribbon group has no sub-groups or all are empty.
int largeButtonWidth () const
 Returns the width of a large button in the current layout.
void layoutSubGroups ()
 Slot that performs the layout of all sub-groups within this ribbon group.
int marginThickness () const
 Returns the margin thickness around the ribbon group content.
uint04 maxNumOfColumns () const
 Returns the maximum number of columns across all sub-groups.
int mediumButtonWidth () const
 Returns the width of a medium button in the current layout.
QSize minimumSizeHint () const override
 Returns the minimum recommended size for this ribbon group.
Vector< 2, int > minSize () const
 Returns the minimum size as a 2D vector (primary, secondary).
RibbonSubGroupoperator[] (const TranslatedString &location)
 Returns the sub-group with the given name, creating it if it does not exist.
RibbonSubGroupremoveSubGroup (const String &sub_group)
 Removes the sub-group with the given string key.
void removeSubGroup (const TranslatedString &sub_group)
 Removes the sub-group with the given translated name.
void resetButtonStates ()
 Resets all button states in all sub-groups to their defaults.
void ribbonResizeEvent (int primary, int secondary)
 Notifies the group of a ribbon resize, triggering sub-group relayout.
void setFixedNumOfRows (uint01 fixed_num_of_rows)
 Sets a fixed number of rows for the layout.
void setNumberOfRows (uint04 number_of_rows)
 Sets the number of rows used for laying out buttons.
void setupSeparator (QFrame *seperator) const
 Configures a separator frame for visual separation between sub-groups.
void setVertical (bool is_vertical)
 Sets whether the ribbon group layout is vertical.
void updateLayout (QSize size)
 Updates the internal layout to fit the given size.

Public Attributes

uint01 m_fixed_num_of_rows
 Fixed number of rows, or 0 for automatic.
bool m_is_vertical
 Whether the layout is vertical.
int m_last_width
 The last known width, used to detect resize changes.
QBoxLayout * m_layout
 The box layout managing sub-group arrangement.
RibbonLayoutMode m_layout_mode
 The current layout mode.
uint04 m_row_num
 Current number of layout rows.
Buffer< QFrame * > m_separators
 Visual separators between sub-groups.
Dictionary< String, RibbonSubGroup * > m_sub_group_lookup
 Sub-groups indexed by name.
Buffer< QWidget * > m_sub_groups
 Ordered list of sub-group widgets.

Detailed Description

Represents the "Tab" of a widget.


For example sections such as Home, View, Edit, Measurements would all be RibbonGroups and children of a Ribbon object.

Definition at line 51 of file RibbonGroup.h.

Constructor & Destructor Documentation

◆ RibbonGroup()

RibbonGroup::RibbonGroup ( QWidget * parent = nullptr)

Constructs a ribbon group widget.

Parameters
[in]parentOptional parent widget.

Member Function Documentation

◆ addSubGroup() [1/2]

RibbonSubGroup * RibbonGroup::addSubGroup ( const TranslatedString & sub_group_name)

Adds a new sub-group with the given name.

Parameters
[in]sub_group_nameThe translated name of the sub-group.
Returns
Pointer to the created RibbonSubGroup.

◆ addSubGroup() [2/2]

void RibbonGroup::addSubGroup ( QWidget * sub_group)

Adds an existing widget as a sub-group.

Parameters
[in]sub_groupThe widget to add as a sub-group.

◆ adjustButtonsToFit()

void RibbonGroup::adjustButtonsToFit ( int primary,
int secondary )

Adjusts button sizes and states to fit within the given dimensions.

Parameters
[in]primaryThe available primary dimension in pixels.
[in]secondaryThe available secondary dimension in pixels.

◆ currentPrimaryDimension()

int RibbonGroup::currentPrimaryDimension ( ) const

Returns the current size along the primary layout axis (width or height).

Returns
The primary dimension in pixels.

◆ currentSecondaryDimension()

int RibbonGroup::currentSecondaryDimension ( ) const

Returns the current size along the secondary layout axis.

Returns
The secondary dimension in pixels.

◆ hasSubGroup()

bool RibbonGroup::hasSubGroup ( const TranslatedString & sub_group) const

Checks whether a sub-group with the given name exists.

Parameters
[in]sub_groupThe translated name to look up.
Returns
True if the sub-group exists.

◆ isEmpty()

bool RibbonGroup::isEmpty ( ) const

Returns whether this ribbon group has no sub-groups or all are empty.

Returns
True if the group is empty.

◆ largeButtonWidth()

int RibbonGroup::largeButtonWidth ( ) const

Returns the width of a large button in the current layout.

Returns
The large button width in pixels.

◆ marginThickness()

int RibbonGroup::marginThickness ( ) const

Returns the margin thickness around the ribbon group content.

Returns
The margin size in pixels.

◆ maxNumOfColumns()

uint04 RibbonGroup::maxNumOfColumns ( ) const

Returns the maximum number of columns across all sub-groups.

Returns
The column count.

◆ mediumButtonWidth()

int RibbonGroup::mediumButtonWidth ( ) const

Returns the width of a medium button in the current layout.

Returns
The medium button width in pixels.

◆ minimumSizeHint()

QSize RibbonGroup::minimumSizeHint ( ) const
override

Returns the minimum recommended size for this ribbon group.

Returns
The minimum size hint.

◆ minSize()

Vector< 2, int > RibbonGroup::minSize ( ) const

Returns the minimum size as a 2D vector (primary, secondary).

Returns
The minimum size vector.

◆ operator[]()

RibbonSubGroup & RibbonGroup::operator[] ( const TranslatedString & location)

Returns the sub-group with the given name, creating it if it does not exist.

Parameters
[in]locationThe translated sub-group name.
Returns
A reference to the RibbonSubGroup.

◆ removeSubGroup() [1/2]

RibbonSubGroup * RibbonGroup::removeSubGroup ( const String & sub_group)

Removes the sub-group with the given string key.

Parameters
[in]sub_groupThe string key of the sub-group to remove.
Returns
Pointer to the removed RibbonSubGroup, or nullptr if not found.

◆ removeSubGroup() [2/2]

void RibbonGroup::removeSubGroup ( const TranslatedString & sub_group)

Removes the sub-group with the given translated name.

Parameters
[in]sub_groupThe translated name of the sub-group to remove.

◆ ribbonResizeEvent()

void RibbonGroup::ribbonResizeEvent ( int primary,
int secondary )

Notifies the group of a ribbon resize, triggering sub-group relayout.

Parameters
[in]primaryThe available primary dimension in pixels.
[in]secondaryThe available secondary dimension in pixels.

◆ setFixedNumOfRows()

void RibbonGroup::setFixedNumOfRows ( uint01 fixed_num_of_rows)

Sets a fixed number of rows for the layout.

Parameters
[in]fixed_num_of_rowsThe number of rows, or 0 for automatic.

◆ setNumberOfRows()

void RibbonGroup::setNumberOfRows ( uint04 number_of_rows)

Sets the number of rows used for laying out buttons.

Parameters
[in]number_of_rowsThe number of rows.

◆ setupSeparator()

void RibbonGroup::setupSeparator ( QFrame * seperator) const

Configures a separator frame for visual separation between sub-groups.

Parameters
[in]seperatorThe QFrame to configure as a separator.

◆ setVertical()

void RibbonGroup::setVertical ( bool is_vertical)

Sets whether the ribbon group layout is vertical.

Parameters
[in]is_verticalTrue for vertical orientation.

◆ updateLayout()

void RibbonGroup::updateLayout ( QSize size)

Updates the internal layout to fit the given size.

Parameters
[in]sizeThe available size.

The documentation for this class was generated from the following file: