diff options
author | David Boddie <dboddie@trolltech.com> | 2010-07-13 15:04:31 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-07-13 15:04:31 (GMT) |
commit | 5608f5c35dd3f4470f51436ead9a7048d561affa (patch) | |
tree | 4a797f9b89b8f811345ddb9752ef6cf391da6336 /examples/tutorials/modelview/1_readonly | |
parent | 3e326e54856b1fce33ab2c005de2a46af6a4ea0f (diff) | |
download | Qt-5608f5c35dd3f4470f51436ead9a7048d561affa.zip Qt-5608f5c35dd3f4470f51436ead9a7048d561affa.tar.gz Qt-5608f5c35dd3f4470f51436ead9a7048d561affa.tar.bz2 |
Doc: Reviewed Michael's model/view tutorial and overview document.
Reviewed-by: Trust Me
Diffstat (limited to 'examples/tutorials/modelview/1_readonly')
5 files changed, 16 insertions, 15 deletions
diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp index ad11f38..fb4726a 100755 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -39,6 +39,7 @@ ****************************************************************************/ //! [Quoting ModelView Tutorial] +// main.cpp #include <QtGui/QApplication> #include "modelview.h" diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp index 027be56..91a97bf 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.cpp +++ b/examples/tutorials/modelview/1_readonly/modelview.cpp @@ -39,6 +39,7 @@ ****************************************************************************/ //! [Quoting ModelView Tutorial] +// modelview.cpp #include <QTableView> #include "modelview.h" #include "mymodel.h" @@ -48,6 +49,6 @@ ModelView::ModelView(QWidget *parent) { tableView = new QTableView(this); setCentralWidget(tableView); - tableView->setModel(new MyModel(this) ); + tableView->setModel(new MyModel(this)); } -//! [Quoting ModelView Tutorial]
\ No newline at end of file +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/modelview.h b/examples/tutorials/modelview/1_readonly/modelview.h index d0f96cd..9307083 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.h +++ b/examples/tutorials/modelview/1_readonly/modelview.h @@ -38,11 +38,11 @@ ** ****************************************************************************/ -//! [Quoting ModelView Tutorial] #ifndef MODELVIEW_H #define MODELVIEW_H - +//! [Quoting ModelView Tutorial] +// modelview.h #include <QtGui/QMainWindow> class QTableView; //forward declaration @@ -56,6 +56,6 @@ public: ModelView(QWidget *parent = 0); }; +//! [Quoting ModelView Tutorial] #endif // MODELVIEW_H -//! [Quoting ModelView Tutorial]
\ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp index c441720..394605a 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.cpp +++ b/examples/tutorials/modelview/1_readonly/mymodel.cpp @@ -39,6 +39,7 @@ ****************************************************************************/ //! [Quoting ModelView Tutorial] +// mymodel.cpp #include "mymodel.h" MyModel::MyModel(QObject *parent) @@ -46,22 +47,19 @@ MyModel::MyModel(QObject *parent) { } -//------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent*/ ) const +int MyModel::rowCount(const QModelIndex & /*parent*/) const { return 2; } -//------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent*/ ) const +int MyModel::columnCount(const QModelIndex & /*parent*/) const { return 3; } -//------------------------------------------------------- -QVariant MyModel::data(const QModelIndex &index, int role ) const +QVariant MyModel::data(const QModelIndex &index, int role) const { - if(role == Qt::DisplayRole) + if (role == Qt::DisplayRole) { return QString("Row%1, Column%2") .arg(index.row() + 1) @@ -69,4 +67,4 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } -//! [Quoting ModelView Tutorial]
\ No newline at end of file +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h index c0ddf4ac6..6065f6e 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.h +++ b/examples/tutorials/modelview/1_readonly/mymodel.h @@ -38,10 +38,11 @@ ** ****************************************************************************/ -//! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H +//! [Quoting ModelView Tutorial] +// mymodel.h #include <QAbstractTableModel> class MyModel : public QAbstractTableModel @@ -53,6 +54,6 @@ public: int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; }; +//! [Quoting ModelView Tutorial] #endif // MYMODEL_H -//! [Quoting ModelView Tutorial]
\ No newline at end of file |