/*********************************************************************** * tableeditor.h * * Provides a header for the TableEditor class, which is our main * interface. * * For the most part, this header is the same as any other Qt object * you'd create. Note, though, that we're creating a pointer to a * QSqlTableModel so it can be referenced throughout the code. We do * not, however, maintain a link to the TableView, as updating that * is managed through the model. * * Written by Paul Bonamy - 30 July 2010 ************************************************************************/ #ifndef TABLEEDITOR_H #define TABLEEDITOR_H #include class QDialogButtonBox; class QPushButton; class QSqlTableModel; class TableEditor : public QDialog { Q_OBJECT public: // constructor TableEditor(const QString &tableName, QWidget *parent = 0); // helper function to set up the model void configureModel(const QString &tableName); private slots: void submit(); // Commit changes to the database void addRecord(); // Add a new record to the model private: QPushButton *submitButton; QPushButton *revertButton; QPushButton *quitButton; QPushButton *addButton; QDialogButtonBox *buttonBox; QSqlTableModel *model; }; #endif