summaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
Diffstat (limited to 'PySide')
-rw-r--r--PySide/CMakeLists.txt1
-rw-r--r--PySide/QtUiTools/CMakeLists.txt40
-rw-r--r--PySide/QtUiTools/typesystem_uitools.xml52
3 files changed, 93 insertions, 0 deletions
diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt
index 6b8b3b2a..c74e0b93 100644
--- a/PySide/CMakeLists.txt
+++ b/PySide/CMakeLists.txt
@@ -39,3 +39,4 @@ HAS_QT_MODULE(QT_QTXML_FOUND QtXml)
HAS_QT_MODULE(QT_QTTEST_FOUND QtTest)
HAS_QT_MODULE(QT_QTOPENGL_FOUND QtOpenGL)
HAS_QT_MODULE(QT_QTSQL_FOUND QtSql)
+HAS_QT_MODULE(QT_QTUITOOLS_FOUND QtUiTools)
diff --git a/PySide/QtUiTools/CMakeLists.txt b/PySide/QtUiTools/CMakeLists.txt
new file mode 100644
index 00000000..1145f976
--- /dev/null
+++ b/PySide/QtUiTools/CMakeLists.txt
@@ -0,0 +1,40 @@
+project(QtUiTools)
+
+set(QtUiTools_SRC
+ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools/qtuitools_module_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools/quiloader_wrapper.cpp
+)
+
+execute_generator(uitools QtUiTools_SRC "${CMAKE_CURRENT_BINARY_DIR}:${QtCore_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtGui_SOURCE_DIR}:${QtXml_SOURCE_DIR}:${QtUiTools_SOURCE_DIR}")
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}
+ ${QT_QTCORE_INCLUDE_DIR}
+ ${QT_QTGUI_INCLUDE_DIR}
+ ${QT_QTXML_INCLUDE_DIR}
+ ${QT_QTUITOOLS_INCLUDE_DIR}
+ ${PYTHON_INCLUDE_PATH}
+ ${SHIBOKEN_INCLUDE_DIR}
+ ${libpyside_SOURCE_DIR}
+ ${QtCore_BINARY_DIR}/PySide/QtCore/
+ ${QtXml_BINARY_DIR}/PySide/QtXml/
+ ${QtGui_BINARY_DIR}/PySide/QtGui/
+ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools)
+
+add_library(QtUiTools MODULE ${QtUiTools_SRC})
+set_target_properties(QtUiTools PROPERTIES PREFIX "")
+target_link_libraries(QtUiTools
+ pyside
+ ${PYTHON_LIBRARIES}
+ ${QT_QTCORE_LIBRARY}
+ ${QT_QTGUI_LIBRARY}
+ ${QT_QTXML_LIBRARY}
+ ${QT_QTUITOOLS_LIBRARY})
+
+add_dependencies(QtUiTools QtGui QtXml)
+
+# install
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/QtUiTools.so
+ DESTINATION ${SITE_PACKAGE}/PySide)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools/pyside_qtuitools_python.h
+ DESTINATION include/PySide/QtUiTools/)
+
diff --git a/PySide/QtUiTools/typesystem_uitools.xml b/PySide/QtUiTools/typesystem_uitools.xml
new file mode 100644
index 00000000..c155bff9
--- /dev/null
+++ b/PySide/QtUiTools/typesystem_uitools.xml
@@ -0,0 +1,52 @@
+<typesystem package="PySide.QtUiTools">
+
+ <load-typesystem name="typesystem_gui.xml" generate="no" />
+ <load-typesystem name="typesystem_xml.xml" generate="no" />
+
+ <object-type name="QUiLoader">
+ <modify-function signature="createAction(QObject *, const QString&amp;)">
+ <modify-argument index="return">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="createActionGroup(QObject *, const QString&amp;)">
+ <modify-argument index="return">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="createLayout(const QString&amp;,QObject *, const QString&amp;)">
+ <modify-argument index="return">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="createWidget(const QString&amp;,QWidget*, const QString&amp;)">
+ <modify-argument index="return">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="load(QIODevice*, QWidget*)">
+ <modify-argument index="return">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <!-- Syntax sugar -->
+ <add-function signature="load(const char*, QWidget*)" return-type="QWidget*">
+ <modify-argument index="return">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ <inject-code>
+ QFile f(%1);
+ if (f.open(QIODevice::ReadOnly | QIODevice::Text))
+ %PYARG_0 = %CONVERTTOPYTHON[QWidget*](%CPPSELF.load(&amp;f, %2));
+ else
+ PyErr_SetString(PyExc_RuntimeError, "Unable to open ui file");
+ </inject-code>
+ </add-function>
+ </object-type>
+
+</typesystem>