NDEVR
API Documentation
RibbonSubGroup

Represents a sub-section of "Tab" of a ribbon representing a grouping of buttons or widgets within a tab that provide similar functions. More...

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

Public Member Functions

 RibbonSubGroup (const TranslatedString &title, QWidget *parent=nullptr)
 Constructs a ribbon sub-group with a title.
 RibbonSubGroup (QWidget *parent=nullptr)
 Constructs a ribbon sub-group widget.
ButtonaddButton (Button *button, uint04 index=Constant< uint04 >::Invalid, bool update_layout=false)
 Adds a button to this sub-group at the specified index.
const Buffer< QPointer< Button > > & buttons () const
 Returns the list of buttons in this sub-group.
Vector< 2, int > calcSize () const
 Calculates the ideal size for this sub-group based on its buttons.
void cleanupEmpty ()
 Removes any buttons that have been destroyed or are empty.
void clear ()
 Removes all buttons from this sub-group.
int currentPrimary () const
 Returns the current size along the primary layout axis.
int currentSecondary () const
 Returns the current size along the secondary layout axis.
Vector< 2, int > estimatedSize () const
 Returns the estimated size of this sub-group.
void init ()
 Initializes the sub-group layout and label after construction.
bool isEmpty () const
 Returns whether this sub-group has no buttons.
int largeButtonWidth () const
 Returns the width of a large button in the current layout.
int marginThickness () const
 Returns the margin thickness around the sub-group content.
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 sub-group.
Vector< 2, int > minSize () const
 Returns the minimum size as a 2D vector (primary, secondary).
uint04 numOfColumns () const
 Returns the number of columns in the current button layout.
void removeButton (Button *button)
 Removes a button from this sub-group.
void requestLayoutUpdate ()
 Signal emitted when the sub-group requests a parent layout update.
void setAvailableButtonStates (const Buffer< Button::ButtonState > &available_button_states)
 Sets the available button states that buttons may cycle through during resize.
void setExpandingIcons (bool expanding)
 Sets whether icons should expand to fill available space.
void setFixedNumOfRows (uint01 fixed_num_of_rows)
 Sets a fixed number of rows for the layout.
void setIconSizeMultiplier (fltp04 size_multiplier)
 Sets a multiplier applied to icon sizes in this sub-group.
void setIgnoredSize (bool ignored)
 Sets whether this sub-group's size should be ignored during layout calculations.
void setLayoutMode (RibbonLayoutMode layout_mode)
 Sets the layout mode for button arrangement.
void setNumberOfRows (uint04 number_of_rows)
 Sets the number of rows used for laying out buttons.
void setSpacing (int spacing)
 Sets the spacing between buttons in the layout.
void setTitle (const TranslatedString &title)
 Sets the displayed title for this sub-group.
void setVertical (bool is_vertical)
 Sets whether the sub-group layout is vertical.
QSize sizeHint () const override
 Returns the recommended size for this sub-group.
virtual void sortButtons (const std::function< bool(Button *, Button *)> &sorter)
 Sorts the buttons in this sub-group using the given comparison function.
const TranslatedStringtitle () const
 Returns the title of this sub-group.
void updateRibbonLayout ()
 Updates the ribbon layout of this sub-group.
void updateRibbonLayoutIfNeeded ()
 Updates the ribbon layout only if changes have been detected.

Protected Attributes

bool m_auto_fill_table
 Whether to automatically fill the layout grid.
Buffer< Button::ButtonStatem_available_button_states
 Allowed button states for adaptive resizing.
QWidget * m_button_panel
 Panel widget containing the buttons.
Buffer< QPointer< Button > > m_buttons
 Ordered list of buttons in the sub-group.
Vector< 2, int > m_estimated_size
 The estimated size used for layout planning.
bool m_expanding_icons
 Whether icons expand to fill available space.
uint01 m_fixed_num_of_rows
 Fixed number of rows, or 0 for automatic.
Vector< 2, int > m_full_size
 The full calculated size of the sub-group.
fltp04 m_icon_size_multiplier
 Multiplier applied to icon sizes.
bool m_ignored_size
 Whether this sub-group's size is ignored during layout.
bool m_is_vertical
 Whether the layout is vertical.
QCustomLabelm_label
 Label displaying the sub-group title.
Vector< 2, int > m_large_button_size
 The size of a large button in the current layout.
int m_last_width
 Last known width, used to detect resize changes.
QGridLayout * m_layout
 Grid layout managing button placement.
RibbonLayoutMode m_layout_mode
 The current layout mode.
uint01 m_num_of_rows
 Current number of layout rows.
TranslatedString m_title
 The displayed title of the sub-group.

Detailed Description

Represents a sub-section of "Tab" of a ribbon representing a grouping of buttons or widgets within a tab that provide similar functions.


Definition at line 47 of file RibbonSubGroup.h.

Constructor & Destructor Documentation

◆ RibbonSubGroup() [1/2]

RibbonSubGroup::RibbonSubGroup ( QWidget * parent = nullptr)

Constructs a ribbon sub-group widget.

Parameters
[in]parentOptional parent widget.

◆ RibbonSubGroup() [2/2]

RibbonSubGroup::RibbonSubGroup ( const TranslatedString & title,
QWidget * parent = nullptr )

Constructs a ribbon sub-group with a title.

Parameters
[in]titleThe translated title displayed below the sub-group.
[in]parentOptional parent widget.

References title().

Member Function Documentation

◆ addButton()

Button * RibbonSubGroup::addButton ( Button * button,
uint04 index = Constantuint04 >::Invalid,
bool update_layout = false )

Adds a button to this sub-group at the specified index.

Parameters
[in]buttonThe button to add.
[in]indexThe insertion index, or Invalid to append.
[in]update_layoutWhether to update the layout immediately after insertion.
Returns
Pointer to the added button.

Referenced by BuildActionProgramLogic::setupUI().

◆ buttons()

const Buffer< QPointer< Button > > & RibbonSubGroup::buttons ( ) const
inline

Returns the list of buttons in this sub-group.

Returns
A const reference to the button buffer.

Definition at line 79 of file RibbonSubGroup.h.

References m_buttons.

◆ calcSize()

Vector< 2, int > RibbonSubGroup::calcSize ( ) const

Calculates the ideal size for this sub-group based on its buttons.

Returns
The calculated size as a 2D vector (primary, secondary).

◆ currentPrimary()

int RibbonSubGroup::currentPrimary ( ) const

Returns the current size along the primary layout axis.

Returns
The primary dimension in pixels.

◆ currentSecondary()

int RibbonSubGroup::currentSecondary ( ) const

Returns the current size along the secondary layout axis.

Returns
The secondary dimension in pixels.

◆ estimatedSize()

Vector< 2, int > RibbonSubGroup::estimatedSize ( ) const
inline

Returns the estimated size of this sub-group.

Returns
The estimated size as a 2D vector.

Definition at line 157 of file RibbonSubGroup.h.

References m_estimated_size.

◆ isEmpty()

bool RibbonSubGroup::isEmpty ( ) const

Returns whether this sub-group has no buttons.

Returns
True if the sub-group is empty.

◆ largeButtonWidth()

int RibbonSubGroup::largeButtonWidth ( ) const

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

Returns
The large button width in pixels.

◆ marginThickness()

int RibbonSubGroup::marginThickness ( ) const

Returns the margin thickness around the sub-group content.

Returns
The margin size in pixels.

◆ mediumButtonWidth()

int RibbonSubGroup::mediumButtonWidth ( ) const

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

Returns
The medium button width in pixels.

◆ minimumSizeHint()

QSize RibbonSubGroup::minimumSizeHint ( ) const
override

Returns the minimum recommended size for this sub-group.

Returns
The minimum size hint.

◆ minSize()

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

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

Returns
The minimum size vector.

◆ numOfColumns()

uint04 RibbonSubGroup::numOfColumns ( ) const

Returns the number of columns in the current button layout.

Returns
The column count.

◆ removeButton()

void RibbonSubGroup::removeButton ( Button * button)

Removes a button from this sub-group.

Parameters
[in]buttonThe button to remove.

◆ setAvailableButtonStates()

void RibbonSubGroup::setAvailableButtonStates ( const Buffer< Button::ButtonState > & available_button_states)

Sets the available button states that buttons may cycle through during resize.

Parameters
[in]available_button_statesThe buffer of allowed button states.

◆ setExpandingIcons()

void RibbonSubGroup::setExpandingIcons ( bool expanding)

Sets whether icons should expand to fill available space.

Parameters
[in]expandingTrue to enable expanding icons.

◆ setFixedNumOfRows()

void RibbonSubGroup::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.

◆ setIconSizeMultiplier()

void RibbonSubGroup::setIconSizeMultiplier ( fltp04 size_multiplier)

Sets a multiplier applied to icon sizes in this sub-group.

Parameters
[in]size_multiplierThe icon size scaling factor.

◆ setIgnoredSize()

void RibbonSubGroup::setIgnoredSize ( bool ignored)

Sets whether this sub-group's size should be ignored during layout calculations.

Parameters
[in]ignoredTrue to ignore this sub-group's size.

◆ setLayoutMode()

void RibbonSubGroup::setLayoutMode ( RibbonLayoutMode layout_mode)
inline

Sets the layout mode for button arrangement.

Parameters
[in]layout_modeThe ribbon layout mode.

Definition at line 163 of file RibbonSubGroup.h.

References m_layout_mode.

◆ setNumberOfRows()

void RibbonSubGroup::setNumberOfRows ( uint04 number_of_rows)

Sets the number of rows used for laying out buttons.

Parameters
[in]number_of_rowsThe number of rows.

◆ setSpacing()

void RibbonSubGroup::setSpacing ( int spacing)

Sets the spacing between buttons in the layout.

Parameters
[in]spacingThe spacing in pixels.

◆ setTitle()

void RibbonSubGroup::setTitle ( const TranslatedString & title)

Sets the displayed title for this sub-group.

Parameters
[in]titleThe translated title text.

References title().

◆ setVertical()

void RibbonSubGroup::setVertical ( bool is_vertical)

Sets whether the sub-group layout is vertical.

Parameters
[in]is_verticalTrue for vertical orientation.

◆ sizeHint()

QSize RibbonSubGroup::sizeHint ( ) const
override

Returns the recommended size for this sub-group.

Returns
The preferred size hint.

◆ sortButtons()

virtual void RibbonSubGroup::sortButtons ( const std::function< bool(Button *, Button *)> & sorter)
virtual

Sorts the buttons in this sub-group using the given comparison function.

Parameters
[in]sorterA comparator returning true if the first button should precede the second.

◆ title()

const TranslatedString & RibbonSubGroup::title ( ) const
inline

Returns the title of this sub-group.

Returns
A const reference to the translated title.

Definition at line 188 of file RibbonSubGroup.h.

References m_title.

Referenced by RibbonSubGroup(), and setTitle().


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