220 const TextListType& TextList,
const bool AllowResetToDefault);
246 template <
typename EnumType, std::enable_if_t<std::is_enum_v<EnumType>,
int> = 0>
275 void AddParam(
ParamInfo&& Info,
const std::any Destiny,
const std::vector<DynExp::ItemIDType>& Values,
315 template <
typename ParamT>
316 void Assign(ParamT& Param,
typename ParamT::UnderlyingType Value);
326 template <
typename ParamT>
327 void Assign(ParamT& Param,
const std::vector<typename ParamT::UnderlyingType::value_type>& Values);
338 std::unique_ptr<Ui::ParamsConfig>
ui;
378 virtual void accept()
override;
379 virtual void reject()
override;
382template <
typename EnumType, std::enable_if_t<std::is_enum_v<EnumType>,
int>>
386 using IntegerType = std::underlying_type_t<EnumType>;
389 auto ComboBox =
new QComboBox(
this);
390 int SelectedIndex = 0;
391 int DefaultIndex = 0;
393 for (
const auto& TextValuePair : TextValueList)
395 if (Value == TextValuePair.second)
396 SelectedIndex = ComboBox->count();
397 if (DefaultValue == TextValuePair.second)
398 DefaultIndex = ComboBox->count();
400 ComboBox->addItem(QString::fromStdString(TextValuePair.first), QVariant(
static_cast<IntegerType
>(TextValuePair.second)));
402 ComboBox->setCurrentIndex(SelectedIndex);
404 Param ParamData(ParamType, ComboBox, Destiny, DefaultIndex);
408template <
typename ParamT>
412 Param = std::move(Value);
415template <
typename ParamT>
419 Param = std::move(Values);
Implements a dialog with a list of available items on the left and a list of selected items on the ri...
Implements a dialog to edit and save small pieces of text or (Python) code.
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Base class for all DynExp Objects like hardware adapters (DynExp::HardwareAdapterBase),...
Defines the configuration dialog. The dialog must be displayed by calling ParamsConfigDialog::Display...
Util::TextListIndexType TextListIndexType
List index type of Util::TextListType.
size_t GetNumParams() const noexcept
Returns the number of parameters added to the configuration dialog.
std::vector< TextEditor * > TextEditorDialogs
Keeps a list of text editor dialogs so that their ownership can be removed when the ParamsConfigDialo...
qulonglong IndexType
ID type of objects/items managed by DynExp.
bool ResetRequired
Becomes true if an existing DynExp::Object is edited and needs to be reset to apply changes after cli...
std::unique_ptr< Ui::ParamsConfig > ui
Bundles Qt widgets of the ParamsConfigDialog instance's user interface.
void Assign(ParamT &Param, typename ParamT::UnderlyingType Value)
When the settings dialog is closed by accepting it, assign a single value from the user interface to ...
std::function< void(void)> FunctionsToCallIfAcceptedType
Signature of a function which is called when the ParamsConfigDialog is closed by the user by clicking...
double NumberType
Number type used for numeric parameters (DynExp::ParamsBase::Param)
void OnOpenParam()
Called when clicking the 'Browse' button for a DynExp::TextUsageType::Path or DynExp::TextUsageType::...
void OnResetParam()
Called when resetting a parameter to its default value.
DynExp::Object * Object
DynExp::Object whose parameters are edited. nullptr if a new DynExp::Object is created and synchroniz...
const DynExp::DynExpCore & Core
Reference to DynExp's core.
Util::TextRefType TextRefType
Reference-to-string type of text-type parameters (DynExp::ParamsBase::Param)
Util::TextListType TextListType
List type of text-type parameters.
bool IsResetRequired() const noexcept
Determines whether the DynExp::Object instance whose parameters have been edited needs to be reset to...
virtual void reject() override
Called when the settings dialog is rejected clicking its 'Cancel' button.
void AddParam(ParamInfo &&Info, const std::any Destiny, const NumberType Value, const NumberType MinValue, const NumberType MaxValue, const NumberType Precision, const NumberType Increment)
Appends a parameter to the configuration dialog.
void InsertWidget(ParamInfo &&Info, Param &&ParamData)
Creates Qt widgets for editing a parameter and inserts them into the configuration dialog.
virtual void accept() override
Called when the settings dialog is accepted clicking its 'OK' button.
std::vector< Param > ParamList
List of all parameters assigned to this ParamsConfigDialog instance.
std::vector< FunctionsToCallIfAcceptedType > FunctionsToCallIfAccepted
List of functions to be called when acceptig the dialog. Refer to ParamsConfigDialog::FunctionsToCall...
void OnEditParam()
Called when opening a TextEditor for a DynExp::TextUsageType::Code parameter.
void HandleTextEditorDialogsOnClose()
Called when the settings dialog is closed. Removes the parent widget of text editors listed in TextEd...
bool Display(DynExp::Object *Object=nullptr)
Displays the configuration dialog.
Util::TextType TextType
" String type of text-type parameters (DynExp::ParamsBase::Param)
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
TextUsageType
Specifies the usage of a text-type parameter. Setting the right usage allows the ParamsConfigDialog t...
size_t ItemIDType
ID type of objects/items managed by DynExp.
std::vector< TextType > TextListType
List type of text-type parameters.
size_t TextListIndexType
List index type of Util::TextListType.
std::string_view TextRefType
Reference-to-string type of text-type parameters (DynExp::ParamsBase::Param)
std::string TextType
String type of text-type parameters (DynExp::ParamsBase::Param)
std::vector< std::pair< TextType, ValueType > > TextValueListType
Type of a list containing key-value pairs where key is a text of type Util::TextType.
Accumulates include statements to provide a precompiled header.
Bundles a parameter's title and description texts.
ParamInfo(std::string Title, std::string Description)
Constructs an instance and initializes Title and Description.
ParamInfo(std::string_view Title, std::string_view Description)
Constructs an instance and initializes Title and Description.
const std::string Title
Refer to DynExp::ParamsBase::ParamBase::ParamTitle.
const std::string Description
Refer to DynExp::ParamsBase::ParamBase::ParamDescription.
Collection of data defining a single parameter to be managed by a ParamsConfigDialog instance....
QWidget *const Widget
Widget to edit/show the parameter's value in the UI.
ParamType
Identifies the type of a parameter shown in the user interface. Also refer to DynExp::TextUsageType.
const ParamType Type
Type of the managed parameter.
const IndexType DefaultIndex
Default selection index for combo box-based parameters used in case of a parameter reset.
const bool AllowResetToDefault
Determines whether to show a reset button in the UI to allow resetting the parameter to its default v...
Param(const ParamType Type, QWidget *const Widget, const std::any Destiny, IndexType DefaultIndex=0, const bool AllowResetToDefault=true)
Constructs a Param instance.
const std::any Destiny
Reference to destination variable where to store the parameter's value after editing.