~ubuntu-branches/ubuntu/natty/pyside/natty-proposed

« back to all changes in this revision

Viewing changes to doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-04-01 15:21:05 UTC
  • mfrom: (1.2.4 upstream) (6.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110401152105-perr3fu2o9fja5rd
Tags: 1.0.1-1
* New 1.0.1 upstream release
  - Bump the B-D chain versions:
    + generatorrunner to 0.6.8.
    + shiboken to 1.0.1.
 
* Move phonon-backend-gstreamer B-D earlier in the list to help the
  aptitude-based resolver (thanks to the pkg-kde team for the help!)
* Use dh_python2, hence get the debug files at the correct place.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    title->setBackgroundRole(QPalette::Base);
68
68
    title->setMargin(8);
69
69
    layout->addWidget(title);
70
 
    
 
70
 
71
71
//! [0]
72
 
    QDirModel *model = new QDirModel;
73
 
    QModelIndex parentIndex = model->index(QDir::currentPath());
74
 
    int numRows = model->rowCount(parentIndex);
 
72
    model = QDirModel()
 
73
    parentIndex = model.index(QDir.currentPath())
 
74
    numRows = model.rowCount(parentIndex)
75
75
//! [0]
76
76
 
77
77
//! [1]
78
 
    for (int row = 0; row < numRows; ++row) {
79
 
        QModelIndex index = model->index(row, 0, parentIndex);
 
78
    for row in range(numRows):
 
79
        index = model.index(row, 0, parentIndex)
80
80
//! [1]
81
81
 
82
82
//! [2]
83
 
        QString text = model->data(index, Qt::DisplayRole).toString();
 
83
        text = model.data(index, Qt.DisplayRole)
84
84
        // Display the text in a widget.
85
85
//! [2]
86
86
 
87
 
        QLabel *label = new QLabel(text, window);
88
 
        layout->addWidget(label);
 
87
        label = QLabel(text, window)
 
88
        layout.addWidget(label)
89
89
//! [3]
90
 
    }
91
90
//! [3]
92
91
 
93
 
    window->setWindowTitle("A simple model example");
94
 
    window->show();
95
 
    return app.exec();
 
92
    window.setWindowTitle("A simple model example")
 
93
    window.show()
 
94
    return app.exec_()
96
95
}