OpenMS
BaseVisualizerGUI.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer:Timo Sachsenberg $
6 // $Authors: Marc Sturm $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
14 #include <OpenMS/CONCEPT/Types.h>
15 
16 #include <QtWidgets>
17 
18 class QPushButton;
19 class QGridLayout;
20 class QLineEdit;
21 class QTextEdit;
22 class QComboBox;
23 class QListWidget;
24 class QLabel;
25 
26 namespace OpenMS
27 {
38  class OPENMS_GUI_DLLAPI BaseVisualizerGUI :
39  public QWidget
40  {
41  Q_OBJECT
42 
43 public:
44 
46  BaseVisualizerGUI(bool editable = false, QWidget * parent = nullptr);
47 
49  bool isEditable() const;
50 
51 signals:
52 
54  void sendStatus(std::string status);
55 
56 public slots:
57 
59  virtual void store() = 0;
60 
61 protected:
62 
64  void addLabel_(const QString& label);
66  void addLabel_(const QString& label, UInt row);
68  void addLineEdit_(QLineEdit * & ptr, QString label);
70  void addIntLineEdit_(QLineEdit * & ptr, QString label);
72  void addDoubleLineEdit_(QLineEdit * & ptr, QString label);
74  void addLineEditButton_(const QString& label, QLineEdit * & ptr1, QPushButton * & ptr2, const QString& buttonlabel);
76  void addListView_(QListWidget * & ptr, QString label);
78  void addTextEdit_(QTextEdit * & ptr, QString label);
80  void addComboBox_(QComboBox * & ptr, QString label);
82  void addBooleanComboBox_(QComboBox * & ptr, QString label);
84  void fillComboBox_(QComboBox * & ptr, const std::string * items, int item_count);
86  void addVSpacer_();
88  void addButton_(QPushButton * & ptr, const QString& label);
90  void add2Buttons_(QPushButton * & ptr1, const QString& label1, QPushButton * & ptr2, const QString& label2);
92  void addSeparator_();
94  void finishAdding_();
95 
97  QPushButton * undo_button_;
99  QGridLayout * mainlayout_;
103  bool editable_;
104  };
105 
106 
107 }
A base class for all visualizer classes.
Definition: BaseVisualizerGUI.h:40
bool isEditable() const
Returns if the values are editable.
void finishAdding_()
Adds buttons common to all visualizers.
void addComboBox_(QComboBox *&ptr, QString label)
Adds a drop-down field to the grid layout.
void addTextEdit_(QTextEdit *&ptr, QString label)
Adds a text edit field to the grid layout.
void add2Buttons_(QPushButton *&ptr1, const QString &label1, QPushButton *&ptr2, const QString &label2)
Adds two buttons in a row.
QPushButton * undo_button_
Undo button.
Definition: BaseVisualizerGUI.h:97
void addVSpacer_()
Adds vertical spacer.
void sendStatus(std::string status)
Sends a status message, if date is not in proper format.
void addListView_(QListWidget *&ptr, QString label)
Adds a list edit field to the grid layout.
BaseVisualizerGUI(bool editable=false, QWidget *parent=nullptr)
Constructor.
void addSeparator_()
Adds a horizontal line as a separator.
virtual void store()=0
Saves the changes made in the GUI to the object.
void addIntLineEdit_(QLineEdit *&ptr, QString label)
Adds a line edit field to the grid layout including a int validator.
void fillComboBox_(QComboBox *&ptr, const std::string *items, int item_count)
Fills a combo box with string items (the number of strings is determined by item_count).
void addLineEditButton_(const QString &label, QLineEdit *&ptr1, QPushButton *&ptr2, const QString &buttonlabel)
Adds a line edit field with label and button to the next free position in the grid.
void addLabel_(const QString &label, UInt row)
Adds a label to a certain row.
bool editable_
Edit flag.
Definition: BaseVisualizerGUI.h:103
UInt row_
Counter for the current grid row.
Definition: BaseVisualizerGUI.h:101
void addDoubleLineEdit_(QLineEdit *&ptr, QString label)
Adds a line edit field to the grid layout including a double validator.
void addLineEdit_(QLineEdit *&ptr, QString label)
Adds a line edit field with label to the grid layout.
void addButton_(QPushButton *&ptr, const QString &label)
Adds a button to the next free position in the grid.
QGridLayout * mainlayout_
The main layout.
Definition: BaseVisualizerGUI.h:99
void addBooleanComboBox_(QComboBox *&ptr, QString label)
Adds a boolean drop-down field to the grid layout ( 'true'=1, 'false'=0 ).
void addLabel_(const QString &label)
Adds a label to the grid layout.
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19