summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-09-29 14:25:23 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-10-01 13:06:38 (GMT)
commit44c5cdc66c5cbeaa88d5dcbb3be629abfb889bcc (patch)
tree1d9cf66c5cceb428d3174ab5ba58245d16146267 /doc
parente3a0975fdf5aa7d997b3890ce2626769ea948d7a (diff)
downloadQt-44c5cdc66c5cbeaa88d5dcbb3be629abfb889bcc.zip
Qt-44c5cdc66c5cbeaa88d5dcbb3be629abfb889bcc.tar.gz
Qt-44c5cdc66c5cbeaa88d5dcbb3be629abfb889bcc.tar.bz2
Doc: Added a script to generate one of the model/view images.
Reviewed-by: Trust Me
Diffstat (limited to 'doc')
-rw-r--r--doc/src/diagrams/programs/standard_views.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/src/diagrams/programs/standard_views.py b/doc/src/diagrams/programs/standard_views.py
new file mode 100644
index 0000000..f1d69f6
--- /dev/null
+++ b/doc/src/diagrams/programs/standard_views.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+import sys
+from PyQt4.QtCore import QDir, Qt
+from PyQt4.QtGui import *
+
+app = QApplication(sys.argv)
+
+background = QWidget()
+palette = QPalette()
+palette.setColor(QPalette.Window, QColor(Qt.white))
+background.setPalette(palette)
+
+model = QFileSystemModel()
+model.setRootPath(QDir.currentPath())
+
+treeView = QTreeView(background)
+treeView.setModel(model)
+treeView.setRootIndex(model.index(QDir.currentPath()))
+
+listView = QListView(background)
+listView.setModel(model)
+listView.setRootIndex(model.index(QDir.currentPath()))
+
+tableView = QTableView(background)
+tableView.setModel(model)
+tableView.setRootIndex(model.index(QDir.currentPath()))
+
+selection = QItemSelectionModel(model)
+treeView.setSelectionModel(selection)
+listView.setSelectionModel(selection)
+tableView.setSelectionModel(selection)
+
+layout = QHBoxLayout(background)
+layout.addWidget(listView)
+layout.addSpacing(24)
+layout.addWidget(treeView, 1)
+layout.addSpacing(24)
+layout.addWidget(tableView)
+background.show()
+
+sys.exit(app.exec_())