aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/stringlistmodel/model.h
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-28 15:41:26 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:01 -0300
commitdd123896b4abf1beeca9c4074dfb0d3711865c8b (patch)
treeed1b68e65126205f59fd465c0c0e365121e480ed /doc/codesnippets/doc/src/snippets/stringlistmodel/model.h
parentb4026126dee2cafb4a2cd3be789e4a5a166b8bf1 (diff)
Fixed/translated some doc. code snippets.
Diffstat (limited to 'doc/codesnippets/doc/src/snippets/stringlistmodel/model.h')
-rw-r--r--doc/codesnippets/doc/src/snippets/stringlistmodel/model.h50
1 files changed, 20 insertions, 30 deletions
diff --git a/doc/codesnippets/doc/src/snippets/stringlistmodel/model.h b/doc/codesnippets/doc/src/snippets/stringlistmodel/model.h
index 30f76114b..0a0b0c3d5 100644
--- a/doc/codesnippets/doc/src/snippets/stringlistmodel/model.h
+++ b/doc/codesnippets/doc/src/snippets/stringlistmodel/model.h
@@ -39,45 +39,35 @@
**
****************************************************************************/
-#ifndef MODEL_H
-#define MODEL_H
-
-#include <QAbstractListModel>
-#include <QObject>
-#include <QStringList>
-
//! [0]
-class StringListModel : public QAbstractListModel
-{
- Q_OBJECT
-
-public:
- StringListModel(const QStringList &strings, QObject *parent = 0)
- : QAbstractListModel(parent), stringList(strings) {}
+class StringListModel (QAbstractListModel):
+ def __init__(strings, parent = None):
+ QAbstractListModel.__init__(self, parent)
+//! [5]
+ self.stringList = strings
+//! [5]
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role) const;
- QVariant headerData(int section, Qt::Orientation orientation,
+ def rowCount(self, parent = QModelIndex()):
+ # ...
+ def data(self, index, role):
+ # ...
+ def headerData(self, section, orientation,
//! [0] //! [1]
- int role = Qt::DisplayRole) const;
+ role = Qt.DisplayRole):
//! [1]
//! [2]
- Qt::ItemFlags flags(const QModelIndex &index) const;
- bool setData(const QModelIndex &index, const QVariant &value,
+ def flags(self, index):
+ # ...
+ def setData(self, index, value,
//! [2] //! [3]
- int role = Qt::EditRole);
+ role = Qt.EditRole)
//! [3]
//! [4]
- bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex());
- bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());
+ def insertRows(self, position, rows, index = QModelIndex()):
+ # ...
+ def removeRows(self, position, rows, index = QModelIndex()):
+ # ...
//! [4]
-//! [5]
-private:
- QStringList stringList;
-};
-//! [5]
-
-#endif