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#include "ui_ChoiceListDialog.h"
16
17class ChoiceListDialog : public QDialog
18{
19 Q_OBJECT
20
21 // Better DynExp::ItemIDType, but this is incompatible with g++ compiler. Should equal ParamsConfigDialog::IndexType.
22 using IndexType = qulonglong;
23
24public:
26 std::string_view ParamName, bool IsOptional, std::string_view IconResourcePath, const std::vector<DynExp::ItemIDType>& Values);
27 ~ChoiceListDialog() = default;
28
29 std::string_view GetParamName() const { return ParamName; }
30 bool IsOptional() const noexcept { return Optional; }
31 const auto& GetSelection() const { return Values; }
32
33private:
34 virtual void showEvent(QShowEvent* event) override;
35
36 Ui::ChoiceListDialog ui;
37
39 const std::string ParamName;
40 const bool Optional;
41 const QIcon ItemIcon;
42 std::vector<DynExp::ItemIDType> Values;
43
44private slots:
45 void OnAddItemClicked();
49
50 virtual void accept() override;
51 virtual void reject() override;
52};
53
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
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.