| 
									
										
										
										
											2013-09-03 13:57:38 -03:00
										 |  |  | #ifndef TABLEVIEW_H
 | 
					
						
							|  |  |  | #define TABLEVIEW_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* This TableView is prepared to have the CSS,
 | 
					
						
							|  |  |  |  * the methods to restore / save the state of | 
					
						
							|  |  |  |  * the column widths and the 'plus' button. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #include <QWidget>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-03 11:54:24 -07:00
										 |  |  | #include "ui_tableview.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-03 13:57:38 -03:00
										 |  |  | class QPushButton; | 
					
						
							|  |  |  | class QAbstractItemModel; | 
					
						
							|  |  |  | class QModelIndex; | 
					
						
							|  |  |  | class QTableView; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-12 17:57:33 -02:00
										 |  |  | class TableView : public QWidget { | 
					
						
							| 
									
										
										
										
											2013-09-03 13:57:38 -03:00
										 |  |  | Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	TableView(QWidget *parent = 0); | 
					
						
							|  |  |  | 	virtual ~TableView(); | 
					
						
							|  |  |  | 	void setTitle(const QString& title); | 
					
						
							|  |  |  | 	/* The model is expected to have a 'remove' slot, that takes a QModelIndex as parameter.
 | 
					
						
							|  |  |  | 	 * It's also expected to have the column '1' as a trash icon. I most probably should create a | 
					
						
							|  |  |  | 	 * proxy model and add that column, will mark that as TODO. see? marked. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	void setModel(QAbstractItemModel* model); | 
					
						
							|  |  |  | 	void setBtnToolTip(const QString& tooltip); | 
					
						
							|  |  |  | 	void fixPlusPosition(); | 
					
						
							|  |  |  | 	void edit(const QModelIndex& index); | 
					
						
							|  |  |  | 	QTableView *view(); | 
					
						
							|  |  |  | protected: | 
					
						
							| 
									
										
										
										
											2013-10-15 04:37:31 -07:00
										 |  |  | 	virtual void showEvent(QShowEvent* ); | 
					
						
							|  |  |  | 	virtual void resizeEvent(QResizeEvent* ); | 
					
						
							| 
									
										
										
										
											2013-09-03 13:57:38 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | signals: | 
					
						
							|  |  |  | 	void addButtonClicked(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2013-10-15 04:37:31 -07:00
										 |  |  | 	Ui::TableView ui; | 
					
						
							| 
									
										
										
										
											2013-09-03 13:57:38 -03:00
										 |  |  | 	QPushButton *plusBtn; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |