DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::desktop_ui::EventFrequencyEntryWidget Class Referencefinal

A widget that facilitates the entry of frequency-based event data via a GUI element. This widget emits signals when new frequency information is entered by the user. More...

#include <EventFrequencyEntryWidget.h>

Inheritance diagram for drn::desktop_ui::EventFrequencyEntryWidget:
Collaboration diagram for drn::desktop_ui::EventFrequencyEntryWidget:

Signals

void selectionChanged (const budgeting::EventFrequency &changed)
 Triggered when the user changes the selected event frequency using a GUI element.
 

Public Member Functions

 EventFrequencyEntryWidget (const foundation::QtPtr<::QWidget > &parent)
 Minimum initialisation constructor.
 
 EventFrequencyEntryWidget (const std::vector< budgeting::EventFrequency > &frequencies, const foundation::QtPtr<::QWidget > &parent)
 Full initialisation constructor, initialising its GUI elements and populating them with the provided frequency options.
 
budgeting::EventFrequency period () const noexcept
 Retrieves the currently selected event frequency from the selection-based GUI element.
 
void select (const budgeting::EventFrequency &period)
 Updates the GUI element to reflect the specified frequency.
 
void setDescription (const ::QString &description)
 Sets the period description on the relevant GUI element for the widget.
 

Detailed Description

A widget that facilitates the entry of frequency-based event data via a GUI element. This widget emits signals when new frequency information is entered by the user.

This class is designed to be used in applications where users need to input frequency-related data, such as intervals, repetitions, or periodic events in a visually intuitive manner. The widget ensures valid data entry and provides feedback for errors. Integration of this widget can help streamline frequency event configuration tasks.

Constructor & Destructor Documentation

◆ EventFrequencyEntryWidget() [1/2]

drn::desktop_ui::EventFrequencyEntryWidget::EventFrequencyEntryWidget ( const foundation::QtPtr<::QWidget > & parent)
explicit

Minimum initialisation constructor.

This constructor initialises the widget by setting up associated GUI components, populating a selection-based GUI element with all the predefined event frequencies, and connecting signals to internal slots.

Parameters
parentThe parent GUI object for hierarchical ownership or scope management. Can also be null for no parent association.

◆ EventFrequencyEntryWidget() [2/2]

drn::desktop_ui::EventFrequencyEntryWidget::EventFrequencyEntryWidget ( const std::vector< budgeting::EventFrequency > & frequencies,
const foundation::QtPtr<::QWidget > & parent )

Full initialisation constructor, initialising its GUI elements and populating them with the provided frequency options.

It sets up the GUI elements, ensuring that an intuitive and interactive interface is available. If the frequency list contains the unknown entry, it is represented with an empty item in the selection list.

Precondition
The frequencies list must not be empty to ensure meaningful initialisation.
Parameters
frequenciesA collection of possible event frequencies to populate the GUI element. These frequencies are displayed for selection and interaction.
parentAn optional GUI container that manages memory and hierarchies; this is usually the parent widget owning the entry widget.

Member Function Documentation

◆ period()

budgeting::EventFrequency drn::desktop_ui::EventFrequencyEntryWidget::period ( ) const
nodiscardnoexcept

Retrieves the currently selected event frequency from the selection-based GUI element.

Returns
The frequency currently selected in the GUI element.
Here is the caller graph for this function:

◆ select()

void drn::desktop_ui::EventFrequencyEntryWidget::select ( const budgeting::EventFrequency & period)

Updates the GUI element to reflect the specified frequency.

This method is used to programmatically select a frequency in the relevant GUI element.

Exceptions
DataEntryErrorThrown if the specified frequency is not a valid option in the GUI element.
Parameters
periodThe period frequency to be selected in the GUI element.
Postcondition
The GUI element reflecting frequency selection is updated to match the input frequency.
Here is the call graph for this function:

◆ selectionChanged

void drn::desktop_ui::EventFrequencyEntryWidget::selectionChanged ( const budgeting::EventFrequency & changed)
signal

Triggered when the user changes the selected event frequency using a GUI element.

It is emitted each time the user modifies the current selection in an event frequency chooser. It enables listeners to respond dynamically, such as updating related fields or recalculating dependent values. It is particularly useful for budget or scheduling operations where event frequencies directly influence computations or visualisations.

Parameters
changedThe newly selected event frequency, indicating how often events are expected to occur. This parameter reflects the user's selection.

◆ setDescription()

void drn::desktop_ui::EventFrequencyEntryWidget::setDescription ( const ::QString & description)

Sets the period description on the relevant GUI element for the widget.

Exceptions
DataEntryErrorThrown if the provided description is empty or composed only of white spaces. This ensures that valid descriptions are always used.
Parameters
descriptionThe new description to be displayed on the associated GUI element. It should clearly convey the intended period's representation.
Postcondition
The GUI element reflecting the period description is updated with the specified text. This change is visible to the user.