13 #ifndef QmitkLevelWindowPresetDefinitionDialog_h
14 #define QmitkLevelWindowPresetDefinitionDialog_h
19 #include <QSortFilterProxyModel>
27 class QmitkLevelWindowPresetDefinition;
57 std::map<std::string, double> &window,
90 Entry(
const std::string &n,
double l,
double w) : name(n), level(l), window(w) {}
94 std::map<std::string, double> &windows,
95 QObject *parent =
nullptr);
97 int rowCount(
const QModelIndex &)
const override;
99 QVariant
data(
const QModelIndex &index,
int)
const override;
101 QVariant
headerData(
int section, Qt::Orientation orientation,
int)
const override;
103 void addPreset(std::string &name,
double level,
double window);
105 void changePreset(
int row, std::string &name,
double level,
double window);
115 std::vector<Entry> m_Entries;
123 std::unique_ptr<Ui::QmitkLevelWindowPresetDefinition>
m_Controls;
QVariant headerData(int section, Qt::Orientation orientation, int) const override
Entry getPreset(const QModelIndex &) const
bool contains(std::string &name)
int rowCount(const QModelIndex &) const override
QVariant data(const QModelIndex &index, int) const override
void removePreset(const QModelIndex &)
int columnCount(const QModelIndex &) const override
void getLevels(std::map< std::string, double > &levels)
void getWindows(std::map< std::string, double > &windows)
void addPreset(std::string &name, double level, double window)
void changePreset(int row, std::string &name, double level, double window)
PresetTableModel(std::map< std::string, double > &levels, std::map< std::string, double > &windows, QObject *parent=nullptr)
Dialog for defining and managing level/window presets.
std::map< std::string, double > getLevelPresets()
Get the edited level presets.
void showEvent(QShowEvent *event) override
QmitkLevelWindowPresetDefinitionDialog(QWidget *parent=nullptr, Qt::WindowFlags f={})
Construct the preset definition dialog.
void resizeEvent(QResizeEvent *event) override
void setPresets(std::map< std::string, double > &level, std::map< std::string, double > &window, QString initLevel, QString initWindow)
Initialize the dialog with existing presets and default values.
QSortFilterProxyModel m_SortModel
PresetTableModel * m_TableModel
~QmitkLevelWindowPresetDefinitionDialog() override
void sortPresets(int index)
void ListViewSelectionChanged(const QItemSelection &, const QItemSelection &)
std::unique_ptr< Ui::QmitkLevelWindowPresetDefinition > m_Controls
std::map< std::string, double > getWindowPresets()
Get the edited window presets.
Entry(const std::string &n, double l, double w)