tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
abstract_widget_list.hpp
Go to the documentation of this file.
1 
27 #ifndef ABSTRACT_WIDGET_LIST_HPP
28 #define ABSTRACT_WIDGET_LIST_HPP
29 
30 #include "colorpicker_global.hpp"
31 
32 #include <QSignalMapper>
33 #include <QTableWidget>
34 
35 class QCP_EXPORT Abstract_Widget_List : public QWidget
36 {
37  Q_OBJECT
38 public:
39  explicit Abstract_Widget_List(QWidget *parent = 0);
41 
45  int count() const;
46 
50  virtual void swap(int a, int b) = 0;
51 
52 
54  bool isValidRow(int i) const { return i >= 0 && i < count(); }
55 
56  void setRowHeight(int row, int height);
57 
58 
59 public slots:
63  void remove(int i);
64 
68  virtual void append() = 0;
69 
70 signals:
71  void removed(int i);
72 
73 protected:
74 
80  void appendWidget(QWidget* w);
81 
85  QWidget* widget(int i);
86 
87 
91  template<class T>
92  T* widget_cast(int i) { return qobject_cast<T*>(widget(i)); }
93 
99  void clear();
100 
101 private slots:
102  void remove_clicked(QWidget* w);
103  void up_clicked(QWidget* w);
104  void down_clicked(QWidget* w);
105 
106 private:
107  class Private;
108  Private * const p;
109 
110  QWidget* create_button(QWidget* data, QSignalMapper*mapper,
111  QString icon_name, QString text,
112  QString tooltip = QString()) const;
113 };
114 
115 #endif // ABSTRACT_WIDGET_LIST_HPP
T * widget_cast(int i)
get the widget found at the given row
Definition: abstract_widget_list.hpp:92
Definition: abstract_widget_list.hpp:35
#define QCP_EXPORT
Definition: colorpicker_global.hpp:9
bool isValidRow(int i) const
Whether the given row index is valid.
Definition: abstract_widget_list.hpp:54