Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
5.4.0 RC
-
None
-
MacOS X 10.10
Description
First of all, I glad to see there are less bugs with QMacNativeWidget (QLineEdit focus issues, rendering issues, borderless window)
I made a simple test with QMacNativeWidget.
I used it in a plug-in for Adobe Illustrator CC.
There is something strange, a piece of a window appears somewhere.
It seems that the QMacNativeWidget creates a window instead of using the provided view
// The code I used, hDlg here is a NSView
{
QMacNativeWidget *nativeWidget = new QMacNativeWidget(hDlg);
nativeWidget->move(0, 0);
nativeWidget->setPalette(QPalette(Qt::red));
nativeWidget->setAutoFillBackground(true);
QVBoxLayout *layout = new QVBoxLayout();
QLineEdit *pushButton = new QLineEdit("An Embedded Qt Button!", nativeWidget);
pushButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // Don't use the layout rect calculated from QMacStyle.
layout->addWidget(pushButton);
nativeWidget->setLayout(layout);
// Adjust Cocoa layouts
NSView *nativeWidgetView = reinterpret_cast<NSView *>(nativeWidget->winId());
NSView *contentView = hDlg;//[window contentView];
[contentView setAutoresizesSubviews:YES];
[nativeWidgetView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[nativeWidgetView setAutoresizesSubviews:YES];
// Add the nativeWidget to the window.
[contentView addSubview:nativeWidgetView];
nativeWidget->show();
pushButton->show();
}
A trial version of Adobe Illustrator CC 2014 and the SDK are available.
If you want to try, I can send you a xcode project.