NDEVR
API Documentation
SnapsEditorWidget

A ribbon sub-group widget that allows the user to configure snap settings such as endpoint, axis, edge, and center snapping. More...

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

Public Member Functions

 SnapsEditorWidget (const DynamicPointer< SnapsManager > &snap_manager, QWidget *parent=nullptr)
 Constructs a snaps editor widget for the given snap manager.
void clearAll ()
 Disables all snap types.
void selectAll ()
 Enables all snap types.
void setupButton (Button *button)
 Configures a button for snap toggle behavior.
void updateFromUI (Button *button)
 Updates the snap manager from a toggled UI button.
void updateUI ()
 Updates all button states to reflect the current snap manager settings.
Public Member Functions inherited from RibbonSubGroup
 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.

Additional Inherited Members

Protected Attributes inherited from RibbonSubGroup
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

A ribbon sub-group widget that allows the user to configure snap settings such as endpoint, axis, edge, and center snapping.


Definition at line 44 of file SnapsEditorWidget.h.

Constructor & Destructor Documentation

◆ SnapsEditorWidget()

SnapsEditorWidget::SnapsEditorWidget ( const DynamicPointer< SnapsManager > & snap_manager,
QWidget * parent = nullptr )

Constructs a snaps editor widget for the given snap manager.

Parameters
[in]snap_managerThe snap manager to configure.
[in]parentThe parent widget.

Member Function Documentation

◆ setupButton()

void SnapsEditorWidget::setupButton ( Button * button)

Configures a button for snap toggle behavior.

Parameters
[in]buttonThe button to set up.

◆ updateFromUI()

void SnapsEditorWidget::updateFromUI ( Button * button)

Updates the snap manager from a toggled UI button.

Parameters
[in]buttonThe button that was toggled.

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