diff options
| author | Christian Tismer <tismer@stackless.com> | 2021-07-03 10:46:33 +0200 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2021-07-06 18:06:25 +0200 |
| commit | 10abd17ffb8826e4aa5861f89642c46c47b641a8 (patch) | |
| tree | 25c6c150c1cbbc5cd793b6e6148fcefc2b18a83f /sources/pyside6/PySide6 | |
| parent | 57500ee1a277dd36fc650baa1af989a648dec9a7 (diff) | |
pathlib: support all cases which are found in the examples
Wherever possible/useful, os.fspath was removed and the
according pathlike modification inserted. This is still
not the awaited end of the conversion, but a good step
forward.
Task-number: PYSIDE-1499
Pick-to: 6.1
Change-Id: I0a22ddeec06ada05dc4a97ed104d06f5f1bbf472
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6')
4 files changed, 24 insertions, 13 deletions
diff --git a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml index 34f22f2ca..6e9332068 100644 --- a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml +++ b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml @@ -533,14 +533,6 @@ </value-type> <value-type name="QPixmap" > - <!--<conversion-rule>--> - <!--<target-to-native replace="no">--> - <!--<add-conversion type="QVariant" check="%CHECKTYPE[QVariant](%in)">--> - <!--QVariant in = %CONVERTTOCPP[QVariant](%in);--> - <!--%out = in.value<%OUTTYPE>();--> - <!--</add-conversion>--> - <!--</target-to-native>--> - <!--</conversion-rule>--> <add-function signature="QPixmap(const QImage&)"> <modify-argument index="1"> <rename to="image"/> @@ -555,7 +547,10 @@ <insert-template name="load_xpm"/> </inject-code> </modify-function> - + <modify-function signature="QPixmap(const QString &, const char *, QFlags<Qt::ImageConversionFlag>)"> + <modify-argument index="1"><replace-type modified-type="PyPathLike"/></modify-argument> + <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qfile-path-1"/> + </modify-function> <!-- ### Operator ! doesn't make sense in Python. --> <modify-function signature="operator!()const" remove="all"/> @@ -680,6 +675,7 @@ </extra-includes> </function> --> <primitive-type name="QImageCleanupFunction"/> + <value-type name="QImage"> <enum-type name="Format"/> <enum-type name="InvertMode"/> @@ -693,7 +689,6 @@ <modify-function signature="load(QIODevice*,const char*)" allow-thread="yes"/> <modify-function signature="save(const QString&,const char*,int)const" allow-thread="yes"/> <modify-function signature="save(QIODevice*,const char*,int)const" allow-thread="yes"/> - <modify-function signature="QImage(uchar*,int,int,qsizetype,QImage::Format,QImageCleanupFunction,void*)"> <modify-argument index="1"> <replace-type modified-type="PyBuffer"/> @@ -715,6 +710,11 @@ </inject-code> </modify-function> + <modify-function signature="QImage(const QString&, const char *)"> + <modify-argument index="1"><replace-type modified-type="PyPathLike"/></modify-argument> + <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qfile-path-1"/> + </modify-function> + <add-function signature="QImage(QString&,int,int,int,QImage::Format)"> <inject-code> <insert-template name="qimage_buffer_constructor"> @@ -773,13 +773,13 @@ --> <modify-function signature="bits()const" remove="all"/> <modify-function signature="scanLine(int)const" remove="all"/> - <modify-function signature="invertPixels(QImage::InvertMode)"> <modify-argument index="1"> <rename to="mode"/> </modify-argument> </modify-function> </value-type> + <value-type name="QCursor" > <extra-includes> <include file-name="QPixmap" location="global"/> diff --git a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml index df88fd466..779ffc332 100644 --- a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml +++ b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml @@ -167,13 +167,23 @@ <object-type name="QQmlDebuggingEnabler"> <enum-type name="StartMode"/> </object-type> + <object-type name="QQmlEngine"> <modify-function signature="addImageProvider(const QString&,QQmlImageProviderBase*)"> <modify-argument index="2"> <define-ownership owner="c++"/> </modify-argument> </modify-function> + <modify-function signature="addImportPath(const QString &)"> + <modify-argument index="1"><replace-type modified-type="PyPathLike"/></modify-argument> + <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qfile-path-1"/> + </modify-function> + <modify-function signature="addPluginPath(const QString &)"> + <modify-argument index="1"><replace-type modified-type="PyPathLike"/></modify-argument> + <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qfile-path-1"/> + </modify-function> </object-type> + <object-type name="QQmlExpression"> <modify-function signature="evaluate(bool*)" allow-thread="yes"> <modify-argument index="1"> diff --git a/sources/pyside6/PySide6/QtUiTools/typesystem_uitools.xml b/sources/pyside6/PySide6/QtUiTools/typesystem_uitools.xml index faefee12b..a8bf52112 100644 --- a/sources/pyside6/PySide6/QtUiTools/typesystem_uitools.xml +++ b/sources/pyside6/PySide6/QtUiTools/typesystem_uitools.xml @@ -130,7 +130,7 @@ </modify-function> <!-- Syntax sugar --> - <add-function signature="load(QString,QWidget*)" return-type="QWidget*"> + <add-function signature="load(PyPathLike,QWidget*)" return-type="QWidget*"> <modify-argument index="2"> <replace-default-expression with="0"/> <rename to="parentWidget"/> diff --git a/sources/pyside6/PySide6/glue/qtuitools.cpp b/sources/pyside6/PySide6/glue/qtuitools.cpp index ea45aeeb5..08cb89c46 100644 --- a/sources/pyside6/PySide6/glue/qtuitools.cpp +++ b/sources/pyside6/PySide6/glue/qtuitools.cpp @@ -108,7 +108,8 @@ registerCustomWidget(%PYARG_1); // @snippet quiloader-load-2 // Avoid calling the original function: %CPPSELF.%FUNCTION_NAME() -%PYARG_0 = QUiLoaderLoadUiFromFileName(%CPPSELF, %1, %2); +auto str = PySide::pyPathToQString(%1); +%PYARG_0 = QUiLoaderLoadUiFromFileName(%CPPSELF, str, %2); // @snippet quiloader-load-2 // @snippet loaduitype |
