summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-01-26 14:11:29 +0100
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-01-28 16:30:24 +0000
commit33bdb93ae1b1a19eb46d924a31a58237850fbfa4 (patch)
tree7a0adb9c85b6bfc3ace123975773a9dfa7561c5c /src/widgets
parent3a30a2fcb3f026ffba4d9484ad92479419d79547 (diff)
Remove some old QT_MAC_USE_COCOA cruft
Change-Id: Ib9cb57563274c722023084e94f2cd439088366a8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/doc/snippets/macmainwindow.mm53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/widgets/doc/snippets/macmainwindow.mm b/src/widgets/doc/snippets/macmainwindow.mm
index d0d74631ab..3e1ee7ca51 100644
--- a/src/widgets/doc/snippets/macmainwindow.mm
+++ b/src/widgets/doc/snippets/macmainwindow.mm
@@ -39,8 +39,6 @@
#include <Carbon/Carbon.h>
-#ifdef QT_MAC_USE_COCOA
-
//![0]
SearchWidget::SearchWidget(QWidget *parent)
: QMacCocoaViewContainer(0, parent)
@@ -76,57 +74,6 @@ QSize SearchWidget::sizeHint() const
return QSize(150, 40);
}
-#else
-
-// The SearchWidget class wraps a native HISearchField.
-SearchWidget::SearchWidget(QWidget *parent)
- :QWidget(parent)
-{
-
- // Create a native search field and pass its window id to QWidget::create.
- searchFieldText = CFStringCreateWithCString(0, "search", 0);
- HISearchFieldCreate(NULL/*bounds*/, kHISearchFieldAttributesSearchIcon | kHISearchFieldAttributesCancel,
- NULL/*menu ref*/, searchFieldText, &searchField);
- create(reinterpret_cast<WId>(searchField));
-
- // Use a Qt menu for the search field menu.
- QMenu *searchMenu = createMenu(this);
- MenuRef menuRef = searchMenu->macMenu(0);
- HISearchFieldSetSearchMenu(searchField, menuRef);
- setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
-}
-
-SearchWidget::~SearchWidget()
-{
- CFRelease(searchField);
- CFRelease(searchFieldText);
-}
-
-// Get the size hint from the search field.
-QSize SearchWidget::sizeHint() const
-{
- EventRef event;
- HIRect optimalBounds;
- CreateEvent(0, kEventClassControl,
- kEventControlGetOptimalBounds,
- GetCurrentEventTime(),
- kEventAttributeUserEvent, &event);
-
- SendEventToEventTargetWithOptions(event,
- HIObjectGetEventTarget(HIObjectRef(winId())),
- kEventTargetDontPropagate);
-
- GetEventParameter(event,
- kEventParamControlOptimalBounds, typeHIRect,
- 0, sizeof(HIRect), 0, &optimalBounds);
-
- ReleaseEvent(event);
- return QSize(optimalBounds.size.width + 100, // make it a bit wider.
- optimalBounds.size.height);
-}
-
-#endif
-
QMenu *createMenu(QWidget *parent)
{
QMenu *searchMenu = new QMenu(parent);