From 8cb9b6d1973e9a1500399c2a2cab151d557c38d7 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Thu, 5 May 2011 14:23:06 -0300 Subject: Updated snippets code to use QFileSystemModel instead of deprecated class QDirModel. Reviewer: Lauro Moura Hugo Parente Lima --- .../doc/src/snippets/shareddirmodel/main.cpp | 3 ++- .../doc/src/snippets/simplemodel-use/main.cpp | 19 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'doc') diff --git a/doc/codesnippets/doc/src/snippets/shareddirmodel/main.cpp b/doc/codesnippets/doc/src/snippets/shareddirmodel/main.cpp index afb2b060..572dd4c4 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 bf9c3f54..55887357 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] -- cgit v1.2.3