DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
ChoiceListDialog.h
Go to the documentation of this file.
1// This file is part of DynExp.
2
10#pragma once
11
12#include "stdafx.h"
13
14#include <QWidget>
15
16namespace Ui
17{
18 class ChoiceListDialog;
19}
20
21class ChoiceListDialog : public QDialog
22{
23 Q_OBJECT
24
25 // Better DynExp::ItemIDType, but this is incompatible with g++ compiler. Should equal ParamsConfigDialog::IndexType.
26 using IndexType = qulonglong;
27
28public:
30 std::string_view ParamName, bool IsOptional, std::string_view IconResourcePath, const std::vector<DynExp::ItemIDType>& Values);
31 ~ChoiceListDialog() = default;
32
33 std::string_view GetParamName() const { return ParamName; }
34 bool IsOptional() const noexcept { return Optional; }
35 const auto& GetSelection() const { return Values; }
36
37private:
38 virtual void showEvent(QShowEvent* event) override;
39
40 std::unique_ptr<Ui::ChoiceListDialog> ui;
41
43 const std::string ParamName;
44 const bool Optional;
45 const QIcon ItemIcon;
46 std::vector<DynExp::ItemIDType> Values;
47
48private slots:
49 void OnAddItemClicked();
53
54 virtual void accept() override;
55 virtual void reject() override;
56};
57
Q_DECLARE_METATYPE(ChoiceListDialog *)
std::vector< DynExp::ItemIDType > Values
std::string_view GetParamName() const
virtual void showEvent(QShowEvent *event) override
bool IsOptional() const noexcept
virtual void reject() override
const std::string ParamName
const Util::TextValueListType< IndexType > ItemIDsWithLabels
std::unique_ptr< Ui::ChoiceListDialog > ui
const auto & GetSelection() const
~ChoiceListDialog()=default
virtual void accept() override
std::vector< std::pair< TextType, ValueType > > TextValueListType
Type of a list containing key-value pairs where key is a text of type Util::TextType.
Definition QtUtil.h:37
Accumulates include statements to provide a precompiled header.