[Qt-interest] Need help with QMacNativeWidget usage
Rush Manbert
rush at manbert.com
Fri Apr 17 18:48:50 CEST 2009
On Mar 27, 2009, at 10:54 AM, Rush Manbert wrote:
> I have been able to use QMacNativeWidget to display a QWebKit widget
> in a native app, using both Carbon and Cocoa native apps.
>
> However, the only way I can get it to work is to instantiate a
> QApplication object (because the Widget constructor asserts unless a
> QApplication object exists), and when I do that it seems to blow away
> the native application's menus. They disappear from the menu bar.
>
> I tried using this QApplication constructor: QApplication(int &argc,
> char **argv, bool GUIenabled, int = QT_VERSION);
> and passing false as the bool argument, but then I can't construct any
> Widgets because the init routine asserts (because graphics aren't
> enabled).
>
> I'm not too proud to beg. Please can someone who understands how this
> is supposed to work explain it? Or can someone please point me to an
> example that shows the proper usage? Google normal and code search
> have not been helpful.
>
> - Rush
> _______________________________________________
One of our customers uses Qt and has had to deal with this problem, so
I'm posting the answer for the next poor person that needs it.
You need this declaration:
#if O_MAC
extern void qt_mac_set_native_menubar(bool);
#endif // O_MAC
And before you instantiate QApplication, you must make this call:
qt_mac_set_native_menubar(false);
This should really get added to the QMacNativeWidget docs. I think
I'll file a bug report.
- Rush
More information about the Qt-interest-old
mailing list