55 #ifndef _MIRA_SINGLESELECTIONLISTDIALOG_H_ 56 #define _MIRA_SINGLESELECTIONLISTDIALOG_H_ 101 template <
typename T>
111 static_assert(
sizeof(T)==0,
"setMultipleSelection not supported for SingleSelectionListDialog");
127 void onSelectionChanged();
130 QLineEdit* mNameField;
136 template <
typename T>
140 QHBoxLayout* layout =
new QHBoxLayout;
142 QLabel* label =
new QLabel(this->tr(
"Name:"),
this);
143 layout->addWidget(label);
145 mNameField =
new QLineEdit(
this);
146 layout->addWidget(mNameField);
150 boost::bind(&SingleSelectionListDialog::onSelectionChanged,
this));
152 this->
mTreeWidget, SIGNAL(itemSelectionChanged()), mSignalBinder,
156 template <
typename T>
160 return std::make_pair(mNameField->text(), this->selectedItems().begin()->second);
163 template <
typename T>
165 return !this->selectedItems().empty();
168 template <
typename T>
171 auto selection = this->selectedItems();
172 if(selection.empty())
173 mNameField->setText(
"");
175 mNameField->setText(selection.begin()->first);
Class that provides different slots with different parameters.
Definition: SignalBinder.h:87
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
SingleSelectionListDialog(QWidget *parent=0)
Definition: SingleSelectionListDialog.h:137
Contains the SelectionListDialog widget, a widget for providing the user a dialog where he/she can ch...
Class that allows to bind a function to a Qt slot that is called upon a connected signal...
#define MIRA_THROW(ex, msg)
Macro for throwing an exception.
Definition: Exception.h:82
QVBoxLayout * mAdditionalContentLayout
Definition: SelectionListDialog.h:178
A dialog for providing the a list, where the items can be grouped in categories.
Definition: SelectionListDialog.h:114
A dialog for providing the a list, where the items can be grouped in categories.
Definition: SingleSelectionListDialog.h:102
bool hasSelection() const
Returns true, if an item was selected.
Definition: SingleSelectionListDialog.h:164
QTreeWidget * mTreeWidget
Definition: SelectionListDialog.h:183
void setMultiSelection(bool enable)
Definition: SingleSelectionListDialog.h:110
void bind(boost::function< void()> f)
binds the given function to the slot "slot()"
Definition: SignalBinder.h:97
std::pair< QString, T > selectedItem() const
Returns a pairs of a string and the data that was assigned in addItem().
Definition: SingleSelectionListDialog.h:157