diff options
author | Michael D Scull <ext-michael.scull@nokia.com> | 2010-06-23 15:19:49 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-07-07 15:10:04 (GMT) |
commit | ca10c2c5a8190cac9c2ae0526f2e250add09d6f2 (patch) | |
tree | b139acbf3f7a5cfd25a9980f78324ff6abeca27a /examples/tutorials/modelview | |
parent | 6de484f195366b560e10f95b04d2f0e7303a2b63 (diff) | |
download | Qt-ca10c2c5a8190cac9c2ae0526f2e250add09d6f2.zip Qt-ca10c2c5a8190cac9c2ae0526f2e250add09d6f2.tar.gz Qt-ca10c2c5a8190cac9c2ae0526f2e250add09d6f2.tar.bz2 |
correction of snippet tags
Diffstat (limited to 'examples/tutorials/modelview')
-rwxr-xr-x | examples/tutorials/modelview/._.DS_Store | bin | 0 -> 4096 bytes | |||
-rwxr-xr-x | examples/tutorials/modelview/1_readonly/main.cpp | 2 | ||||
-rwxr-xr-x | examples/tutorials/modelview/1_readonly/modelview.cpp | 3 | ||||
-rwxr-xr-x | examples/tutorials/modelview/1_readonly/modelview.h | 3 | ||||
-rwxr-xr-x | examples/tutorials/modelview/1_readonly/mymodel.cpp | 2 | ||||
-rwxr-xr-x | examples/tutorials/modelview/1_readonly/mymodel.h | 2 | ||||
-rwxr-xr-x | examples/tutorials/modelview/2_formatting/mymodel.cpp | 3 | ||||
-rwxr-xr-x | examples/tutorials/modelview/3_changingmodel/mymodel.cpp | 7 | ||||
-rwxr-xr-x | examples/tutorials/modelview/4_headers/mymodel.cpp | 3 | ||||
-rwxr-xr-x | examples/tutorials/modelview/5_edit/mymodel.cpp | 8 | ||||
-rwxr-xr-x | examples/tutorials/modelview/5_edit/mymodel.h | 2 | ||||
-rwxr-xr-x | examples/tutorials/modelview/6_treeview/modelview.cpp | 2 | ||||
-rwxr-xr-x | examples/tutorials/modelview/7_selections/modelview.cpp | 6 | ||||
-rwxr-xr-x | examples/tutorials/modelview/qmake.pro | 10 |
14 files changed, 45 insertions, 8 deletions
diff --git a/examples/tutorials/modelview/._.DS_Store b/examples/tutorials/modelview/._.DS_Store Binary files differnew file mode 100755 index 0000000..338bd7b --- /dev/null +++ b/examples/tutorials/modelview/._.DS_Store diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp index 998503c..bdf740c 100755 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #include <QtGui/QApplication> #include "modelview.h" @@ -8,3 +9,4 @@ int main(int argc, char *argv[]) w.show(); return a.exec(); } +//! [Quoting ModelView Tutorial]
\ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp index becd61d..14311f9 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.cpp +++ b/examples/tutorials/modelview/1_readonly/modelview.cpp @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #include <QTableView> #include "modelview.h" #include "mymodel.h" @@ -9,4 +10,4 @@ ModelView::ModelView(QWidget *parent) setCentralWidget(tableView); tableView->setModel(new MyModel(this) ); } - +//! [Quoting ModelView Tutorial]
\ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/modelview.h b/examples/tutorials/modelview/1_readonly/modelview.h index f1b63bd..93b6b90 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.h +++ b/examples/tutorials/modelview/1_readonly/modelview.h @@ -1,6 +1,8 @@ +//! [Quoting ModelView Tutorial] #ifndef MODELVIEW_H #define MODELVIEW_H + #include <QtGui/QMainWindow> class QTableView; //forward declaration @@ -16,3 +18,4 @@ public: }; #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 ff3e2d2..3386907 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.cpp +++ b/examples/tutorials/modelview/1_readonly/mymodel.cpp @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #include "mymodel.h" MyModel::MyModel(QObject *parent) @@ -28,3 +29,4 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } +//! [Quoting ModelView Tutorial]
\ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h index 01ae6cb..aac1bf0 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.h +++ b/examples/tutorials/modelview/1_readonly/mymodel.h @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H @@ -14,3 +15,4 @@ public: }; #endif // MYMODEL_H +//! [Quoting ModelView Tutorial]
\ No newline at end of file diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp index 48b1134..916dabc 100755 --- a/examples/tutorials/modelview/2_formatting/mymodel.cpp +++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp @@ -3,6 +3,7 @@ #include "mymodel.h" #include <QDebug> +//! [Quoting ModelView Tutorial] MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { @@ -70,4 +71,4 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } - +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp index d594175..fa7f566 100755 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp @@ -3,7 +3,7 @@ #include <QBrush> #include "mymodel.h" - +//! [quoting mymodel_a] MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { @@ -13,7 +13,7 @@ MyModel::MyModel(QObject *parent) connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()) ); timer->start(); } - +//! [quoting mymodel_a] //------------------------------------------------------- int MyModel::rowCount(const QModelIndex & /*parent */ ) const { @@ -43,6 +43,7 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } //------------------------------------------------------- +//! [quoting mymodel_b ] void MyModel::timerHit() { //we identify the top left cell @@ -50,4 +51,4 @@ void MyModel::timerHit() //emit a signal to make the view reread identified data emit dataChanged ( topLeft, topLeft ); } - +//! [quoting mymodel_b ] diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp index a032fe5..7891c80 100755 --- a/examples/tutorials/modelview/4_headers/mymodel.cpp +++ b/examples/tutorials/modelview/4_headers/mymodel.cpp @@ -29,7 +29,7 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const return QVariant(); } - +//! [quoting mymodel_c] QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role == Qt::DisplayRole) @@ -48,3 +48,4 @@ QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) } return QVariant(); } +//! [quoting mymodel_c]
\ No newline at end of file diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp index c64a6b7..ef45bc3 100755 --- a/examples/tutorials/modelview/5_edit/mymodel.cpp +++ b/examples/tutorials/modelview/5_edit/mymodel.cpp @@ -1,3 +1,4 @@ +//! [quoting mymodel_d] #include "mymodel.h" const int COLS= 3; @@ -9,7 +10,9 @@ MyModel::MyModel(QObject *parent) //gridData needs to have 6 element, one for each table cell m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; } +//! [quoting mymodel_d] +//! [quoting mymodel_e] //------------------------------------------------------- int MyModel::rowCount(const QModelIndex & /*parent*/ ) const { @@ -31,8 +34,11 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } +//! [quoting mymodel_e] //----------------------------------------------------------------- + +//! [quoting mymodel_f] bool MyModel::setData ( const QModelIndex & index, const QVariant & value, int role ) { if(role == Qt::EditRole) @@ -55,4 +61,4 @@ int MyModel::modelIndexToOffset(const QModelIndex & index) const { return index.row()*COLS + index.column(); } - +//! [quoting mymodel_f] diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h index f8fac77..1612fa0 100755 --- a/examples/tutorials/modelview/5_edit/mymodel.h +++ b/examples/tutorials/modelview/5_edit/mymodel.h @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H @@ -22,3 +23,4 @@ signals: }; #endif // MYMODEL_H +//! [Quoting ModelView Tutorial]
\ No newline at end of file diff --git a/examples/tutorials/modelview/6_treeview/modelview.cpp b/examples/tutorials/modelview/6_treeview/modelview.cpp index a5488f7..b5b4d06 100755 --- a/examples/tutorials/modelview/6_treeview/modelview.cpp +++ b/examples/tutorials/modelview/6_treeview/modelview.cpp @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #include <QTreeView> #include <QStandardItemModel> #include <QStandardItem> @@ -38,3 +39,4 @@ QList<QStandardItem *> ModelView::prepareColumn(const QString &first, colItems << new QStandardItem(third); return colItems; } +//! [Quoting ModelView Tutorial]
\ No newline at end of file diff --git a/examples/tutorials/modelview/7_selections/modelview.cpp b/examples/tutorials/modelview/7_selections/modelview.cpp index 49c5bb8..eac6df9 100755 --- a/examples/tutorials/modelview/7_selections/modelview.cpp +++ b/examples/tutorials/modelview/7_selections/modelview.cpp @@ -1,3 +1,4 @@ +//! [quoting modelview_a] #include <QTreeView> #include <QStandardItemModel> #include <QItemSelectionModel> @@ -41,8 +42,11 @@ ModelView::ModelView(QWidget *parent) connect(selectionModel, SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), this, SLOT(selectionChangedSlot(const QItemSelection & , const QItemSelection & ))); } +//! [quoting modelview_a] //------------------------------------------------------------------------------------ + +//! [quoting modelview_b] void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/) { const QModelIndex index = treeView->selectionModel()->currentIndex(); @@ -58,6 +62,6 @@ void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, co .arg(hierarchyLevel); setWindowTitle(showString); } - +//! [quoting modelview_b] diff --git a/examples/tutorials/modelview/qmake.pro b/examples/tutorials/modelview/qmake.pro new file mode 100755 index 0000000..7f684ba --- /dev/null +++ b/examples/tutorials/modelview/qmake.pro @@ -0,0 +1,10 @@ +TEMPLATE = subdirs + +SUBDIRS = 1_readonly \ + 2_formatting \ + 3_changingmodel \ + 4_headers \ + 5_edit \ + 6_treeview \ + 7_selections + |