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/mymodel.cpp | |
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/mymodel.cpp')
-rwxr-xr-x | examples/tutorials/modelview/1_readonly/mymodel.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
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] |