Qt embedded in Cocoa
Qt embedded in Cocoa
- Subject: Qt embedded in Cocoa
- From: "Atanas Bakalov" <email@hidden>
- Date: Wed, 30 May 2007 13:48:02 +0300
- Thread-topic: Qt embedded in Cocoa
Hi,
I'm trying to embed a QT window in a Cocoa application. I follow the
guidelines described in
/Developer/Examples/CoreAudio/Documentation/AudioUnits/CarbonViewCocoaWi
ndow.rtfd.
The embedding is done in 3 steps:
1. I place the code for QT window creation/message loop in a dll
2. From the Cocoa app we call a function in the dll , which
function crates the QT GUI thread with QApplication::exec().
3. From the Cocoa app we call a function in the dll, which
function:
a. sends a message to QT GUI Thread
b. In the handler of that message (we are in the GUI Thread) we
create a window containing two buttons.
c. We return the WindowRef (with HIViewGetWindow(pWidget->winId))
to the dll caller (the cocoa app)
d. The cocoa app uses the technique described in
CarbonViewCocoaWindow.rtfd to embed the newly created QT window in the
Cocoa Main Window.
This works great. However here is the problem.
If we try to create another window/message box/dialog from the QT code
(inside the QT button's on-click handler) we have the following output
in the console and the application crashes:
QWidget::repaint: Recursive repaint detected
QWidget: It is dangerous to leave painters active on a widget outside of
the PaintEvent
QPainter::begin: Widget painting can only begin as a result of a
paintEvent
QWidget::repaint: Recursive repaint detected
QWidget: It is dangerous to leave painters active on a widget outside of
the PaintEvent
QPainter::begin: Widget painting can only begin as a result of a
paintEvent
cocoaApp has exited due to signal 10 (SIGBUS).
OR:
2007-05-30 13:41:50.250 cocoaApp[3051] *** _NSAutoreleaseNoPool():
Object 0x398570 of class NSCarbonWindowContentView autoreleased with no
pool in place - just leaking
cocoaApp(3051,0xa000cf60) malloc: *** error for object 0x3a331c:
Non-aligned pointer being freed
cocoaApp(3051,0xa000cf60) malloc: *** set a breakpoint in szone_error to
debug
cocoaApp(3051,0x184a000) malloc:
cocoaApp has exited due to signal 11 (SIGSEGV).
Also the thread that crashes the application is the Cocoa thread, not
the QT Thread.
Does anybody have an idea why this happens?
Thanks in advance,
Atanas Bakalov.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden