summaryrefslogtreecommitdiffstats
path: root/examples/tutorials/modelview/5_edit/modelview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tutorials/modelview/5_edit/modelview.cpp')
-rwxr-xr-xexamples/tutorials/modelview/5_edit/modelview.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/tutorials/modelview/5_edit/modelview.cpp b/examples/tutorials/modelview/5_edit/modelview.cpp
new file mode 100755
index 0000000..b6e8e34
--- /dev/null
+++ b/examples/tutorials/modelview/5_edit/modelview.cpp
@@ -0,0 +1,20 @@
+#include <QTableView>
+#include "modelview.h"
+#include "mymodel.h"
+
+ModelView::ModelView(QWidget *parent)
+ : QMainWindow(parent)
+{
+ tableView = new QTableView(this);
+ setCentralWidget(tableView);
+ QAbstractTableModel *myModel = new MyModel(this);
+ tableView->setModel( myModel );
+
+ //transfer changes to the model to the window title
+ connect(myModel, SIGNAL(editCompleted(const QString &) ), this, SLOT(setWindowTitle(const QString &)));
+}
+
+void ModelView::showWindowTitle(const QString & title)
+{
+setWindowTitle( title );
+}