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>
This commit is contained in:
parent
7542b1c726
commit
8cb9b6d197
2 changed files with 11 additions and 11 deletions
|
|
@ -55,7 +55,8 @@ def main():
|
||||||
splitter = QSplitter()
|
splitter = QSplitter()
|
||||||
|
|
||||||
//! [2] //! [3]
|
//! [2] //! [3]
|
||||||
model = QDirModel()
|
model = QFileSystemModel()
|
||||||
|
model.setRootPath(QDir.currentPath())
|
||||||
//! [0] //! [2] //! [4] //! [5]
|
//! [0] //! [2] //! [4] //! [5]
|
||||||
tree = QTreeView(splitter)
|
tree = QTreeView(splitter)
|
||||||
//! [3] //! [6]
|
//! [3] //! [6]
|
||||||
|
|
|
||||||
|
|
@ -57,19 +57,18 @@
|
||||||
order to indicate that we want top-level items.
|
order to indicate that we want top-level items.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
def main():
|
||||||
{
|
app = QApplication(sys.argc, sys.argv)
|
||||||
QApplication app(argc, argv);
|
|
||||||
|
|
||||||
QWidget *window = new QWidget;
|
window = QWidget()
|
||||||
QVBoxLayout *layout = new QVBoxLayout(window);
|
layout = QVBoxLayout(window)
|
||||||
QLabel *title = new QLabel("Some items from the directory model", window);
|
title = QLabel("Some items from the directory model", window)
|
||||||
title->setBackgroundRole(QPalette::Base);
|
title.setBackgroundRole(QPalette.Base)
|
||||||
title->setMargin(8);
|
title.setMargin(8)
|
||||||
layout->addWidget(title);
|
layout.addWidget(title)
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
model = QDirModel()
|
model = QFileSystemModel()
|
||||||
parentIndex = model.index(QDir.currentPath())
|
parentIndex = model.index(QDir.currentPath())
|
||||||
numRows = model.rowCount(parentIndex)
|
numRows = model.rowCount(parentIndex)
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue