NDEVR
API Documentation
ButtonGallery

A scrollable gallery widget that displays a collection of Buttons in a flow layout. More...

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

Public Member Functions

 ButtonGallery (QWidget *parent=nullptr)
 Constructs a ButtonGallery with an optional parent widget.
virtual void addButton (Button *button)
 Adds a button to the gallery.
const Buffer< QPointer< Button > > & buttons () const
 Returns the list of buttons currently in the gallery.
virtual void clear ()
 Removes all buttons from the gallery.
virtual void removeButton (Button *button)
 Removes a button from the gallery.
void setIconSizeMultiplier (fltp04 multiplier)
 Sets the icon size multiplier applied to all buttons in the gallery.
QSize sizeHint () const override
 Returns the recommended size for the gallery widget.
virtual void sortButtons ()
 Sorts buttons alphabetically.
virtual void sortButtons (const std::function< bool(Button *, Button *)> &sorter)
 Sorts buttons using a custom comparison function.
void updateGalleryLayout ()
 Updates the layout of buttons within the gallery after additions or removals.
Public Member Functions inherited from QCustomScrollArea
 QCustomScrollArea (QWidget *parent=nullptr)
 Constructs a custom scroll area widget.
bool eventFilter (QObject *, QEvent *event) override
 Filters events for the child widget to handle resize and layout updates.
void setUseFullScroll (bool use_full_scroll)
 Sets whether the scroll area uses full scroll mode, where the scroll area expands to accommodate the full content size in the size hint.
void setWidget (QWidget *w)
 Sets the scrollable child widget.
QSize sizeHint () const override
 Returns the recommended size for the scroll area.
QWidget * takeWidget ()
 Removes and returns the scrollable child widget without deleting it.
bool useFullScroll () const
 Returns whether full scroll mode is enabled.

Protected Attributes

RibbonSubGroupm_gallery
 The internal ribbon sub-group managing the button layout.
Protected Attributes inherited from QCustomScrollArea
bool m_use_full_scroll = false
 Whether the scroll area uses full scroll mode.

Detailed Description

A scrollable gallery widget that displays a collection of Buttons in a flow layout.


Definition at line 12 of file ButtonGallery.h.

Constructor & Destructor Documentation

◆ ButtonGallery()

ButtonGallery::ButtonGallery ( QWidget * parent = nullptr)

Constructs a ButtonGallery with an optional parent widget.

Parameters
[in]parentThe parent widget.

Member Function Documentation

◆ addButton()

virtual void ButtonGallery::addButton ( Button * button)
virtual

Adds a button to the gallery.

Parameters
[in]buttonThe button to add.

◆ buttons()

const Buffer< QPointer< Button > > & ButtonGallery::buttons ( ) const

Returns the list of buttons currently in the gallery.

Returns
A const reference to the buffer of button pointers.

◆ removeButton()

virtual void ButtonGallery::removeButton ( Button * button)
virtual

Removes a button from the gallery.

Parameters
[in]buttonThe button to remove.

◆ setIconSizeMultiplier()

void ButtonGallery::setIconSizeMultiplier ( fltp04 multiplier)

Sets the icon size multiplier applied to all buttons in the gallery.

Parameters
[in]multiplierThe icon size multiplier (1.0 = default).

◆ sizeHint()

QSize ButtonGallery::sizeHint ( ) const
override

Returns the recommended size for the gallery widget.

Returns
The preferred size hint.

◆ sortButtons() [1/2]

virtual void ButtonGallery::sortButtons ( )
virtual

Sorts buttons alphabetically.


◆ sortButtons() [2/2]

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

Sorts buttons using a custom comparison function.

Parameters
[in]sorterThe comparison function returning true if the first button should precede the second.

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