Vuo  2.0.1
VuoInputEditorWithLineEditList.hh
Go to the documentation of this file.
1 
10 #pragma once
11 
13 
18 {
19  Q_OBJECT
20 
21 public:
22  VuoInputEditorWithLineEditList(bool allowAddingAndRemovingRows=false, int lineEditWidth=100);
23  virtual bool supportsTabbingBetweenPorts(void);
24 
25 protected:
26  virtual void setUpDialog(QDialog &dialog, json_object *originalValue, json_object *details);
27  virtual QLayout * setUpRow(QDialog &dialog, QLineEdit *lineEdit);
28  virtual void tearDownRow(QLayout *rowLayout);
29  QLayout * getRowAtIndex(int index);
30  void addWidgetToDialog(QWidget *widget);
31  void removeWidgetFromDialog(QWidget *widget);
33  QList<QString> getLineEditTexts(void);
34 
38  virtual QList<QString> convertToLineEditListFormat(json_object *value) = 0;
39 
43  virtual json_object * convertFromLineEditListFormat(const QList<QString> &lineEditTexts) = 0;
44 
45 private slots:
46  void addRow(void);
47  void removeRow(void);
48 
49 private:
50  void updateUI(void);
51 
52  bool allowAddingAndRemovingRows;
53  int lineEditWidth;
54  QList<QLayout *> rowLayouts;
55  QList<QLineEdit *> lineEdits;
56  QList<QAbstractButton *> removeButtons;
57  QAbstractButton *addButton;
58  QVBoxLayout *dialogLayout;
59 
60  static const int horizontalSpacing;
61  static const int verticalSpacing;
62 };