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>
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. | |
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.
|
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.
parent | The parent GUI object for hierarchical ownership or scope management. Can also be null for no parent association. |
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.
frequencies
list must not be empty to ensure meaningful initialisation.frequencies | A collection of possible event frequencies to populate the GUI element. These frequencies are displayed for selection and interaction. |
parent | An optional GUI container that manages memory and hierarchies; this is usually the parent widget owning the entry widget. |
|
nodiscardnoexcept |
Retrieves the currently selected event frequency from the selection-based GUI element.
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.
DataEntryError | Thrown if the specified frequency is not a valid option in the GUI element. |
period | The period frequency to be selected in the GUI element. |
|
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.
changed | The newly selected event frequency, indicating how often events are expected to occur. This parameter reflects the user's selection. |
void drn::desktop_ui::EventFrequencyEntryWidget::setDescription | ( | const ::QString & | description | ) |
Sets the period description on the relevant GUI element for the widget.
DataEntryError | Thrown if the provided description is empty or composed only of white spaces. This ensures that valid descriptions are always used. |
description | The new description to be displayed on the associated GUI element. It should clearly convey the intended period's representation. |