summaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-09-01 20:58:41 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2010-09-02 15:07:59 -0300
commit8f4246a522aa02c9e1d7e44ab6a18d13075d53b9 (patch)
tree34e4551d31960708e3850ca03f8231211dd3fcd3 /PySide
parent94ce2814e9a3709ab7d60f3acee6576fe9476b1d (diff)
downloadpyside-8f4246a522aa02c9e1d7e44ab6a18d13075d53b9.tar.gz
pyside-8f4246a522aa02c9e1d7e44ab6a18d13075d53b9.tar.xz
pyside-8f4246a522aa02c9e1d7e44ab6a18d13075d53b9.zip
Fix bug#125 - "QAbstractTextDocumentLayout.registerHandler apparently not working"
Added class QPyTextObject which inherits from QObject and QTextObjectInterface to solve the issue with registerHandler, the same approach used by PyQt. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Ara├║jo <renato.filho@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r--PySide/CMakeLists.txt4
-rw-r--r--PySide/QtGui/CMakeLists.txt7
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml3
-rw-r--r--PySide/global.h.in1
-rw-r--r--PySide/qpytextobject.h16
5 files changed, 27 insertions, 4 deletions
diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt
index edd3b44..e4b6a1d 100644
--- a/PySide/CMakeLists.txt
+++ b/PySide/CMakeLists.txt
@@ -27,8 +27,8 @@ macro(create_pyside_module module_name module_include_dir module_libraries modul
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running generator for ${module_name}...")
- include_directories(${module_name} ${${module_include_dir}})
- add_library(${module_name} MODULE ${${module_sources}})
+ include_directories(${module_name} ${${module_include_dir}} ${pyside_SOURCE_DIR})
+ add_library(${module_name} MODULE ${${module_sources}} ${${ARGN}})
set_target_properties(${module_name} PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY ${pyside_BINARY_DIR})
if(WIN32)
set_target_properties(${module_name} PROPERTIES SUFFIX ".pyd")
diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt
index 902243b..64aa73f 100644
--- a/PySide/QtGui/CMakeLists.txt
+++ b/PySide/QtGui/CMakeLists.txt
@@ -55,6 +55,8 @@ else()
)
endif ()
+qt4_wrap_cpp(QPYTEXTOBJECT_MOC "${pyside_SOURCE_DIR}/qpytextobject.h")
+
set(QtGui_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qabstractbutton_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qabstractgraphicsshapeitem_wrapper.cpp
@@ -227,6 +229,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpolygon_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qprogressbar_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qprogressdialog_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qproxymodel_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpytextobject_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpushbutton_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qradialgradient_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qradiobutton_wrapper.cpp
@@ -395,6 +398,7 @@ check_qt_class(QtGui QPrintEngine QtGui_SRC)
set(QtGui_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}")
set(QtGui_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/
+ ${pyside_SOURCE_DIR}
${QT_INCLUDE_DIR}
${SHIBOKEN_INCLUDE_DIR}
${libpyside_SOURCE_DIR}
@@ -412,5 +416,6 @@ create_pyside_module(QtGui
QtGui_deps
QtGui_typesystem_path
QtGui_SRC
- "${CMAKE_CURRENT_BINARY_DIR}/typesystem_gui.xml")
+ "${CMAKE_CURRENT_BINARY_DIR}/typesystem_gui.xml"
+ QPYTEXTOBJECT_MOC)
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 48bad7a..b217509 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -1388,6 +1388,7 @@
<modify-argument index="1" invalidate-after-use="yes"/>
</modify-function>
</object-type>
+ <object-type name="QPyTextObject" />
<object-type name="QActionGroup">
<modify-function signature="addAction(QAction*)">
<modify-argument index="1">
@@ -2527,7 +2528,7 @@
<extra-includes>
<include file-name="autoarraypointer.h" location="global"/>
</extra-includes>
-
+
<modify-argument index="2">
<remove-argument/>
<conversion-rule class="native">
diff --git a/PySide/global.h.in b/PySide/global.h.in
index 1bec8bb..7a4c650 100644
--- a/PySide/global.h.in
+++ b/PySide/global.h.in
@@ -353,6 +353,7 @@ QT_END_HEADER
#undef qdoc
#endif
#include <QtGui/QtGui>
+#include "qpytextobject.h"
#if @ENABLE_X11@
#include <QtGui/QX11Info>
#endif
diff --git a/PySide/qpytextobject.h b/PySide/qpytextobject.h
new file mode 100644
index 0000000..80c5b7e
--- /dev/null
+++ b/PySide/qpytextobject.h
@@ -0,0 +1,16 @@
+#ifndef QPYTEXTOBJECT
+#define QPYTEXTOBJECT
+
+#include <QObject>
+#include <QTextObjectInterface>
+
+class QPyTextObject : public QObject, public QTextObjectInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QTextObjectInterface)
+public:
+ QPyTextObject(QObject* parent = 0) : QObject(parent) {}
+ void drawObject(QPainter* painter, const QRectF& rect, QTextDocument* doc, int posInDocument, const QTextFormat& format ) = 0;
+ QSizeF intrinsicSize(QTextDocument* doc, int posInDocument, const QTextFormat& format ) = 0;
+};
+#endif \ No newline at end of file