Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
6.3.0
-
None
Description
The C++ signature of QVersionNumber::fromString() is:
QVersionNumber QVersionNumber::fromString(const QString &string, int *suffixIndex = nullptr)
where suffixIndex is used as an out-argument. There are other occurences of this in Qt, e.g. QFileDialog::getSaveFileName:
QString QFileDialog::getSaveFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = Options())
where selectedFilter is used to return the file type filter the user selected in the dialog.
For that one, PySide6 actually handles this in the same way as PyQt does, by returning a tuple instead:
<modify-argument index="return"> <replace-type modified-type="(fileName, selectedFilter)"/> </modify-argument> // ... <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qfiledialog-return" />
But contrary to PyQt, it does not do the same thing for QVersionNumber, thus rendering parts of its functionality unusable:
>>> from PyQt6.QtCore import QVersionNumber >>> s = "1.5.0.post1" >>> v, i = QVersionNumber.fromString(s) >>> s[i:] '.post1' >>> v <PyQt6.QtCore.QVersionNumber object at 0x7ff4392c97e0>
but:
>>> from PySide6.QtCore import QVersionNumber >>> s = "1.5.0.post1" >>> v = QVersionNumber.fromString(s) >>> v <1.5.0 at 0x7efc51e22040>
because PySide6 simply drops the argument entirely:
<modify-function signature="fromString(const QString &,int*)"> <modify-argument index="2"> <remove-argument/> </modify-argument> </modify-function>
And there seems no good way to get it back before PySide7 now, because doing so
is backwards-incompatible.