diff --git a/src/widgets/qocoa_mac.h b/src/widgets/qocoa_mac.h index 741df59d9..263339ded 100644 --- a/src/widgets/qocoa_mac.h +++ b/src/widgets/qocoa_mac.h @@ -26,8 +26,6 @@ THE SOFTWARE. #include #include #include -#include -#include static inline NSString* fromQString(const QString &string) { @@ -51,16 +49,3 @@ static inline NSImage* fromQPixmap(const QPixmap &pixmap) { return [ [NSImage alloc] initWithCGImage:cgImage size:NSZeroSize]; } - -static inline void setupLayout(NSView *cocoaView, QWidget *parent) { - - parent->setAttribute(Qt::WA_NativeWindow); - QVBoxLayout *layout = new QVBoxLayout(parent); - layout->setMargin(0); - // FIXME - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - layout->addWidget(new QMacCocoaViewContainer(cocoaView, parent)); - #pragma GCC diagnostic pop - -} diff --git a/src/widgets/qsearchfield_mac.mm b/src/widgets/qsearchfield_mac.mm index 822d1448d..893fd764e 100644 --- a/src/widgets/qsearchfield_mac.mm +++ b/src/widgets/qsearchfield_mac.mm @@ -21,7 +21,6 @@ THE SOFTWARE. */ #include "qsearchfield.h" - #include "qocoa_mac.h" #import "Foundation/NSAutoreleasePool.h" @@ -29,8 +28,11 @@ THE SOFTWARE. #import "AppKit/NSSearchField.h" #include -#include +#include +#include #include +#include +#include class QSearchFieldPrivate : public QObject { public: @@ -155,16 +157,24 @@ public: @end QSearchField::QSearchField(QWidget *parent) : QWidget(parent) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSSearchField *search = [[QocoaSearchField alloc] init]; QSearchFieldDelegate *delegate = [[QSearchFieldDelegate alloc] init]; pimpl = delegate->pimpl = new QSearchFieldPrivate(this, search); [search setDelegate:(id)delegate]; - setupLayout(search, this); + + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setMargin(0); + layout->addWidget(QWidget::createWindowContainer(QWindow::fromWinId(WId(search)), this)); + + setAttribute(Qt::WA_NativeWindow); setFixedHeight(24); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + [search release]; [pool drain]; + } void QSearchField::setIconSize(const int iconsize) {