summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-05-05 14:23:06 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-05-05 15:45:26 -0300
commit964eb13adf4760a20c07e629f62c7d6f14fac132 (patch)
tree4e3a1005116e88a4f97bd4b5b9902297aa8fe59d /doc
parent29c263eeb8bc736d2a8d00ac7125db70b0d2fb6a (diff)
downloadpyside-964eb13adf4760a20c07e629f62c7d6f14fac132.tar.gz
pyside-964eb13adf4760a20c07e629f62c7d6f14fac132.tar.xz
pyside-964eb13adf4760a20c07e629f62c7d6f14fac132.zip
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.cpp3
-rw-r--r--doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp19
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 afb2b06..572dd4c 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 bf9c3f5..5588735 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]