|
mupp 1.1.0
|
The PVarDialog class provides a GUI for defining custom variables. More...
#include <PVarDialog.h>


Signals | |
| void | check_request (QString varStr, QVector< int > idx) |
| Signal emitted when user requests to check variable definitions. | |
| void | add_request (QString varStr, QVector< int > idx) |
| Signal emitted when user requests to add variable definitions. | |
Public Member Functions | |
| PVarDialog (QVector< PCollInfo > collection_list, bool darkTheme, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
| Constructor for PVarDialog. | |
Private Slots | |
| void | check () |
| Slot to validate variable definitions and emit check_request signal. | |
| void | add () |
| Slot to validate and add variable definitions, emitting add_request signal. | |
| void | help () |
| Slot to display help information about variable syntax. | |
| void | showVarNames () |
| Slot to show a dialog displaying variable names from the selected collection. | |
Private Member Functions | |
| bool | basic_check () |
| Performs basic validation checks on variable definitions. | |
| bool | var_consistency_check () |
| Validates that all identifiers exist in selected collections. | |
| QStringList | collectVarNames (QStringList &list, bool &ok) |
| Collects all variable names from a tokenized string list. | |
| bool | hasErrorDef (QStringList &varNames, QString &name) |
| Checks that each variable has a corresponding error definition. | |
Private Attributes | |
| std::unique_ptr< QPlainTextEdit > | fVarEdit |
| text editor for variable definitions | |
| std::unique_ptr< QListWidget > | fCollectionView |
| list widget displaying available collections | |
| std::unique_ptr< QPushButton > | fCancel |
| cancel button to reject the dialog | |
| std::unique_ptr< QPushButton > | fAdd |
| add button to add variables to mupp GUI | |
| std::unique_ptr< QPushButton > | fCheck |
| check button to validate variable definitions | |
| std::unique_ptr< QPushButton > | fHelp |
| help button to display syntax information | |
| std::unique_ptr< QPushButton > | fShowVarName |
| button to show variable names from selected collection | |
| QVector< PCollInfo > | fCollList |
| vector holding all collection information | |
The PVarDialog class provides a GUI for defining custom variables.
This dialog allows users to define custom variables based on existing variables from selected collections. Variables are defined using expressions that can reference collection variables as identifiers (prefixed with '$'). The dialog validates that both a variable and its corresponding error variable (suffixed with 'Err') are defined, and checks that all identifiers exist in the selected collections.
Example variable definition:
Definition at line 92 of file PVarDialog.h.
| PVarDialog::PVarDialog | ( | QVector< PCollInfo > | collection_list, |
| bool | darkTheme, | ||
| QWidget * | parent = nullptr, | ||
| Qt::WindowFlags | f = Qt::WindowFlags() ) |
Constructor for PVarDialog.
| collection_list | vector of PCollInfo structures containing all available collections |
| darkTheme | flag indicating whether to use dark theme icons (true) or plain icons (false) |
| parent | optional parent widget pointer |
| f | optional window flags for the dialog |
Creates a variable definition dialog with a text editor for variable expressions and a collection list view. The dialog allows users to define custom variables using expressions that reference collection variables as identifiers (prefixed with '$'). Multiple collections can be selected, and the dialog validates that all identifiers exist in the selected collections.
The dialog includes buttons for:
| collection_list | vector of all available collections with their variable names |
| darkTheme | if true, uses dark theme icons; if false, uses plain icons |
| parent | optional parent widget pointer |
| f | optional window flags for the dialog |
Definition at line 113 of file PVarDialog.cpp.
|
privateslot |
Slot to validate and add variable definitions, emitting add_request signal.
Validates and adds variable definitions to the mupp GUI.
Checks that input is present and at least one collection is selected. Performs basic checks and consistency validation. If all checks pass, emits the add_request signal with the variable string and selected collection indices.
Definition at line 220 of file PVarDialog.cpp.
|
signal |
Signal emitted when user requests to add variable definitions.
| varStr | the complete variable definition string from the text editor |
| idx | vector of indices indicating which collections are selected |
|
private |
Performs basic validation checks on variable definitions.
Validates the following:
Definition at line 331 of file PVarDialog.cpp.
|
privateslot |
Slot to validate variable definitions and emit check_request signal.
Validates variable definitions and emits check_request signal.
Performs basic checks (syntax, presence of 'var' keyword, error variable definitions) and consistency checks (identifiers exist in collections). If validation succeeds, emits the check_request signal with the variable string and selected collection indices.
Definition at line 194 of file PVarDialog.cpp.
|
signal |
Signal emitted when user requests to check variable definitions.
| varStr | the complete variable definition string from the text editor |
| idx | vector of indices indicating which collections are selected |
|
private |
Collects all variable names from a tokenized string list.
| list | reference to a tokenized string list containing variable definitions |
| ok | reference to a boolean flag indicating success or failure |
Scans the input list for 'var' keywords and extracts the following token as the variable name. Sets the ok flag to false if a 'var' keyword is found at the end of the list without a following variable name.
| list | reference to a tokenized string list containing variable definitions |
| ok | reference to boolean flag; set to true if all 'var' keywords have associated names, false otherwise |
Definition at line 498 of file PVarDialog.cpp.
|
private |
Checks that each variable has a corresponding error definition.
For every variable name that doesn't end with 'Err', checks that a corresponding variable with 'Err' suffix exists.
| varNames | reference to a list of variable names to check |
| name | reference to QString that will hold the name of the first variable without an error definition |
For every variable name in the list that doesn't contain 'Err', checks that a corresponding variable with an 'Err' suffix exists in the list. If any variable lacks its error counterpart, the variable name is stored in the name parameter.
| varNames | reference to a list of variable names to validate |
| name | reference to QString that will hold the name of the first variable without an error definition |
Definition at line 530 of file PVarDialog.cpp.
|
privateslot |
Slot to display help information about variable syntax.
Displays help information about variable definition syntax.
Shows a message box explaining the syntax for defining variables:
Definition at line 257 of file PVarDialog.cpp.
|
privateslot |
Slot to show a dialog displaying variable names from the selected collection.
Displays variable names from the selected collection.
Shows a PShowVarNameDialog containing all variable names from the currently selected collection. Only one collection can be displayed at a time. Displays error messages if no collection is selected, multiple collections are selected, or if an invalid collection index is encountered.
Definition at line 294 of file PVarDialog.cpp.
|
private |
Validates that all identifiers exist in selected collections.
Checks that every identifier (prefixed with '$') used in the variable definitions exists either as a variable being defined or as a variable in one of the selected collections.
Collects all identifiers (prefixed with '$') and variable names from the variable definition string. For each identifier, checks that it either:
Handles both regular identifiers and error identifiers (ending with 'Err'). Displays error message if any identifier is not found in selected collections.
Definition at line 397 of file PVarDialog.cpp.
|
private |
add button to add variables to mupp GUI
Definition at line 112 of file PVarDialog.h.
|
private |
cancel button to reject the dialog
Definition at line 111 of file PVarDialog.h.
|
private |
check button to validate variable definitions
Definition at line 113 of file PVarDialog.h.
|
private |
list widget displaying available collections
Definition at line 110 of file PVarDialog.h.
|
private |
vector holding all collection information
Definition at line 117 of file PVarDialog.h.
|
private |
help button to display syntax information
Definition at line 114 of file PVarDialog.h.
|
private |
button to show variable names from selected collection
Definition at line 115 of file PVarDialog.h.
|
private |
text editor for variable definitions
Definition at line 109 of file PVarDialog.h.