@@ -235,8 +235,38 @@ def gen_defs():
235235{internal}
236236
237237</typesystem>"""
238+
239+ xmlall = xmlbase .format (internal = xmlinternal + xml )
240+
241+
242+ def maybeparse (xx : str ):
243+ with open (
244+ f"{ MY_SITE_PACKAGES_PATH } /PySide6/include/QtCore/pyside6_qtcore_python.h" , "r"
245+ ) as ff :
246+ qtcore = ff .read ()
247+ if not ("SBK_QString_IDX" in qtcore ):
248+ xx = xx .replace ("SBK_QLayoutItem_IDX" , "SBK_QLAYOUTITEM_IDX" )
249+ xx = xx .replace ("SBK_QLayout_IDX" , "SBK_QLAYOUT_IDX" )
250+ xx = xx .replace ("SBK_QString_IDX" , "SBK_QSTRING_IDX" )
251+ xx = xx .replace ("SBK_QWidget_IDX" , "SBK_QWIDGET_IDX" )
252+ xx = xx .replace (
253+ "SbkPySide6_QtWidgetsTypeStructs" , "SbkPySide6_QtWidgetsTypes"
254+ )
255+ xx = xx .replace (
256+ "SBK_ElaNavigationType_NodeOperateReturnType_IDX" ,
257+ "SBK_ELANAVIGATIONTYPE_NODEOPERATERETURNTYPE_IDX" ,
258+ )
259+ return xx
260+
261+
238262with open ("bindings.xml" , "w" , encoding = "utf8" ) as ff :
239- ff .write (xmlbase .format (internal = xmlinternal + xml ))
263+ ff .write (maybeparse (xmlall ))
264+
265+ with open ("special.hpp" , "r" , encoding = "utf8" ) as ff :
266+ special = ff .read ()
267+
268+ with open ("special.hpp" , "w" , encoding = "utf8" ) as ff :
269+ ff .write (maybeparse (special ))
240270
241271
242272wrapperbase = """
@@ -255,6 +285,7 @@ def gen_defs():
255285with open ("wrapper.hpp" , "w" , encoding = "utf8" ) as ff :
256286 ff .write (wrapperbase .format (internal = H_internal + "\n " + h ))
257287
288+
258289sysinclude = ""
259290if "msvc2019" in MY_QT_INSTALL :
260291 # <=6.7必须使用msvc2019的头文件
0 commit comments