Details
-
Bug
-
Resolution: Done
-
P4: Low
-
None
-
6.3.1
-
None
-
9f72774579 (pyside/pyside-setup/dev) becb2b6b64 (pyside/pyside-setup/6.3) becb2b6b64 (pyside/tqtc-pyside-setup/6.3) 9f72774579 (pyside/tqtc-pyside-setup/dev) becb2b6b64 (pyside/pyside-setup/wip/6.3_pypy) c4817b8751 (pyside/tqtc-pyside-setup/6.2)
Description
Here's one example.
Notice also that most "if" and "else" lines don't have colons, and the one that does is indented wrongly.
Cpp snippet (from https://doc.qt.io/qt-6/qtwidgets-itemviews-simpletreemodel-example.html)
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const { if (!hasIndex(row, column, parent)) return QModelIndex(); TreeItem *parentItem; if (!parent.isValid()) parentItem = rootItem; else parentItem = static_cast<TreeItem*>(parent.internalPointer()); TreeItem *childItem = parentItem->child(row); if (childItem) return createIndex(row, column, childItem); return QModelIndex(); }
Auto-converted Python snippet (from https://doc.qt.io/qtforpython/overviews/qtwidgets-itemviews-simpletreemodel-example.html)
def index(self, int row, int column, QModelIndex parent): if (not hasIndex(row, column, parent)) def QModelIndex(): parentItem = TreeItem() if (not parent.isValid()) parentItem = rootItem else: parentItem = TreeItem(parent.internalPointer()) childItem = parentItem.child(row) if (childItem) def createIndex(row,column,childItem): def QModelIndex():
Attachments
Issue Links
- is duplicated by
-
PYSIDE-2051 Events + Filters docs show non-working code
- Closed