diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-05-05 14:23:06 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:19 -0300 |
commit | 8cb9b6d1973e9a1500399c2a2cab151d557c38d7 (patch) | |
tree | 7fd577da03c4038d9b2c8dd6995183c7dbd81eb9 /doc | |
parent | 7542b1c7265d7d686d38bad3256bbd5bb2040c7a (diff) |
Updated snippets code to use QFileSystemModel instead of deprecated class QDirModel.
Reviewer: Lauro Moura <lauro.neto@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/codesnippets/doc/src/snippets/shareddirmodel/main.cpp | 3 | ||||
-rw-r--r-- | doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp | 19 |
2 files changed, 11 insertions, 11 deletions
diff --git a/doc/codesnippets/doc/src/snippets/shareddirmodel/main.cpp b/doc/codesnippets/doc/src/snippets/shareddirmodel/main.cpp index afb2b060b..572dd4c44 100644 --- a/doc/codesnippets/doc/src/snippets/shareddirmodel/main.cpp +++ b/doc/codesnippets/doc/src/snippets/shareddirmodel/main.cpp @@ -55,7 +55,8 @@ def main(): splitter = QSplitter() //! [2] //! [3] - model = QDirModel() + model = QFileSystemModel() + model.setRootPath(QDir.currentPath()) //! [0] //! [2] //! [4] //! [5] tree = QTreeView(splitter) //! [3] //! [6] diff --git a/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp b/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp index bf9c3f540..558873578 100644 --- a/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp +++ b/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp @@ -57,19 +57,18 @@ order to indicate that we want top-level items. */ -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); +def main(): + app = QApplication(sys.argc, sys.argv) - QWidget *window = new QWidget; - QVBoxLayout *layout = new QVBoxLayout(window); - QLabel *title = new QLabel("Some items from the directory model", window); - title->setBackgroundRole(QPalette::Base); - title->setMargin(8); - layout->addWidget(title); + window = QWidget() + layout = QVBoxLayout(window) + title = QLabel("Some items from the directory model", window) + title.setBackgroundRole(QPalette.Base) + title.setMargin(8) + layout.addWidget(title) //! [0] - model = QDirModel() + model = QFileSystemModel() parentIndex = model.index(QDir.currentPath()) numRows = model.rowCount(parentIndex) //! [0] |