A GUI item providing a selectable list of currencies. More...
#include <CurrencyCodeWidget.h>
Public Slots | |
void | setCurrentCode (const pecunia::Currency &code) |
Updates the currently selected currency in the GUI item. | |
Public Member Functions | |
CurrencyComboBox (const foundation::QtPtr<::QWidget > &parent) | |
Constructs a specialized GUI item for selecting currencies. | |
std::set< pecunia::Currency > | currencies () const |
Retrieves the set of currencies currently displayed in the GUI item. | |
pecunia::Currency | currentCode () const |
Retrieves the currently selected currency code from the GUI item. | |
void | populateUsableCurrencies (const std::set< pecunia::Currency > &usableCodes, const navigation::CurrencyDisplayOptions &displayAs) |
Populates the GUI item with a list of usable currencies. | |
A GUI item providing a selectable list of currencies.
This class represents a specialized GUI element that allows users to select from a predefined set of currencies. It supports dynamic updates to its list of options and emits signals when the selection changes, enabling seamless integration with other components in the application.
|
explicit |
Constructs a specialized GUI item for selecting currencies.
This constructor initializes a GUI element that provides users with the ability to select currencies from a list. The list is displayed and managed in an alphabetically sorted order to ensure usability and clarity. The widget is created within the given parent GUI container, if specified.
parent | The GUI element acting as the container for this widget. |
|
nodiscard |
Retrieves the set of currencies currently displayed in the GUI item.
This method should be used to get a snapshot of the selectable currency options at any given point in time.
|
nodiscard |
Retrieves the currently selected currency code from the GUI item.
This function returns the currency code corresponding to the user's current selection in the GUI element. It ensures that the value aligns with predefined and usable currency codes.
DataEntryError | Throws this exception if the selected country code is not supported or recognized. The error will indicate the problematic input and provide additional context. |
void drn::desktop_ui::CurrencyComboBox::populateUsableCurrencies | ( | const std::set< pecunia::Currency > & | usableCodes, |
const navigation::CurrencyDisplayOptions & | displayAs ) |
Populates the GUI item with a list of usable currencies.
This function updates the selectable options within the GUI element to reflect a given set of usable currencies. The GUI item's contents are kept consistent with the provided data, ensuring accurate and usable output for end-users.
usableCodes | A collection of currency codes that are considered valid and should be added to the list. |
displayAs | The specific manner in which each currency should be displayed within the GUI element. |
usableCodes
collection.
|
slot |
Updates the currently selected currency in the GUI item.
This function sets the current selection of a GUI element representing a selectable list of currencies. It ensures logical display behavior for a specific currency, adjusting the display text or index based on predefined conditions. It integrates seamlessly with other parts of the application for real-time updates.
code | The currency to be set as the currently selected value. |