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
For Gerrit Dashboard: PYSIDE-2030 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
426697,2 | snippets_translate: Fix the tests | 6.3 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
426702,2 | snippets_translate: Fix the tests | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
426734,3 | snippets_translate: Do convert return statements to functions | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
426735,3 | Long live qtcpp2py.py! | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
426741,2 | snippets_translate: Fix indented conditions | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
426781,3 | snippets_translate: Fix the tests | tqtc/lts-6.2 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
426792,2 | snippets_translate: Fix indented conditions | 6.3 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
426821,2 | snippets_translate: Fix indented conditions | tqtc/lts-6.2 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
426978,2 | snippets_translate: Do convert return statements to functions | 6.3 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
426996,2 | snippets_translate: Do convert return statements to functions | tqtc/lts-6.2 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |