summaryrefslogtreecommitdiffstats
path: root/tests/manual/cocoa
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-28 11:58:30 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-28 14:16:52 +0200
commit92a32e050fe0c545d0b7b70501c224d09f8d9ed6 (patch)
tree77cb0c2e73aae4de18ad6ddb79f1037d633b8ab7 /tests/manual/cocoa
parent7fe7bd326ff692067d7349153ad274a631762dff (diff)
Remove QMacNativeWidget and QMacCocoaViewContainer
The functionality should be available via QWidget::winId(), and QWidget::createWindowContainer() + QWindow::fromWinId(). Any bugs in this area should be fixed by improving the general wrapping APIs. Fixes: QTBUG-83254 Change-Id: I86584a4a8138d17d65a50da39efd58039f10da91 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/manual/cocoa')
-rw-r--r--tests/manual/cocoa/qmaccocoaviewcontainer/CMakeLists.txt21
-rw-r--r--tests/manual/cocoa/qmaccocoaviewcontainer/TestMouseMovedNSView.h32
-rw-r--r--tests/manual/cocoa/qmaccocoaviewcontainer/TestMouseMovedNSView.m112
-rw-r--r--tests/manual/cocoa/qmaccocoaviewcontainer/main.mm96
-rw-r--r--tests/manual/cocoa/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro8
5 files changed, 0 insertions, 269 deletions
diff --git a/tests/manual/cocoa/qmaccocoaviewcontainer/CMakeLists.txt b/tests/manual/cocoa/qmaccocoaviewcontainer/CMakeLists.txt
deleted file mode 100644
index f6c21b8c23..0000000000
--- a/tests/manual/cocoa/qmaccocoaviewcontainer/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated from qmaccocoaviewcontainer.pro.
-
-#####################################################################
-## qmaccocoaviewcontainer Binary:
-#####################################################################
-
-qt_add_manual_test(qmaccocoaviewcontainer
- GUI
- SOURCES
- TestMouseMovedNSView.h TestMouseMovedNSView.m
- main.mm
- INCLUDE_DIRECTORIES
- .
- PUBLIC_LIBRARIES
- ${FWAppKit}
- Qt::Gui
- Qt::Widgets
-)
-
-#### Keys ignored in scope 1:.:.:qmaccocoaviewcontainer.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/manual/cocoa/qmaccocoaviewcontainer/TestMouseMovedNSView.h b/tests/manual/cocoa/qmaccocoaviewcontainer/TestMouseMovedNSView.h
deleted file mode 100644
index 4a145a729f..0000000000
--- a/tests/manual/cocoa/qmaccocoaviewcontainer/TestMouseMovedNSView.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2016 The Qt Company Ltd.
- ** Contact: https://www.qt.io/licensing/
- **
- ** This file is part of the test suite of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and The Qt Company. For licensing terms
- ** and conditions see https://www.qt.io/terms-conditions. For further
- ** information use the contact form at https://www.qt.io/contact-us.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3 as published by the Free Software
- ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
- ** included in the packaging of this file. Please review the following
- ** information to ensure the GNU General Public License requirements will
- ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#import <AppKit/AppKit.h>
-
-@interface TestMouseMovedNSView : NSView
-@end
diff --git a/tests/manual/cocoa/qmaccocoaviewcontainer/TestMouseMovedNSView.m b/tests/manual/cocoa/qmaccocoaviewcontainer/TestMouseMovedNSView.m
deleted file mode 100644
index 20a3fcc513..0000000000
--- a/tests/manual/cocoa/qmaccocoaviewcontainer/TestMouseMovedNSView.m
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2016 The Qt Company Ltd.
- ** Contact: https://www.qt.io/licensing/
- **
- ** This file is part of the test suite of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and The Qt Company. For licensing terms
- ** and conditions see https://www.qt.io/terms-conditions. For further
- ** information use the contact form at https://www.qt.io/contact-us.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3 as published by the Free Software
- ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
- ** included in the packaging of this file. Please review the following
- ** information to ensure the GNU General Public License requirements will
- ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#import "TestMouseMovedNSView.h"
-
-@implementation TestMouseMovedNSView {
- NSPoint mouseMovedPoint_;
- BOOL wasAcceptingMouseEvents_;
- NSTrackingRectTag trackingRect_;
- NSTrackingArea* trackingArea_;
-}
-
-- (instancetype)initWithFrame:(NSRect)frame
-{
- self = [super initWithFrame:frame];
- if (self)
- mouseMovedPoint_ = NSMakePoint(50, 50);
- return self;
-}
-
-- (void)viewDidMoveToWindow
-{
- trackingArea_ = [[NSTrackingArea alloc] initWithRect:self.bounds options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways) owner:self userInfo:nil];
- [self addTrackingArea:trackingArea_];
-}
-
-- (void)viewWillMoveToWindow:(NSWindow *)newWindow
-{
- if (self.window && trackingArea_)
- [self removeTrackingArea:trackingArea_];
-}
-
-- (void)updateTrackingAreas
-{
- [super updateTrackingAreas];
- [self removeTrackingArea: trackingArea_];
- trackingArea_ = [[NSTrackingArea alloc] initWithRect:self.bounds options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways) owner:self userInfo:nil];
- [self addTrackingArea:trackingArea_];
-}
-
-- (BOOL)acceptsFirstResponder { return YES; }
-- (BOOL)becomeFirstResponder { return YES; }
-
-- (void)mouseEntered:(NSEvent *)theEvent
-{
- wasAcceptingMouseEvents_ = [[self window] acceptsMouseMovedEvents];
- [self.window setAcceptsMouseMovedEvents:YES];
- [self.window makeFirstResponder:self];
-}
-
-- (void)mouseExited:(NSEvent *)theEvent
-{
- [self.window setAcceptsMouseMovedEvents:wasAcceptingMouseEvents_];
- [self setNeedsDisplay:YES];
- [self displayIfNeeded];
-}
-
--(void)mouseMoved:(NSEvent *)pTheEvent
-{
- mouseMovedPoint_ = [self convertPoint:pTheEvent.locationInWindow fromView:nil];
- [self setNeedsDisplay:YES];
- [self displayIfNeeded];
-}
-
-- (void)drawRect:(NSRect)dirtyRect
-{
- [[NSColor whiteColor] set];
- NSRectFill(dirtyRect);
-
- NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext currentContext];
- CGContextRef cgContextRef = nsGraphicsContext.CGContext;
-
- CGContextSetRGBStrokeColor(cgContextRef, 0, 0, 0, .5);
- CGContextSetLineWidth(cgContextRef, 1.0);
-
- CGContextBeginPath(cgContextRef);
-
- CGContextMoveToPoint(cgContextRef, mouseMovedPoint_.x, 0);
- CGContextAddLineToPoint(cgContextRef, mouseMovedPoint_.x, 1000);
-
- CGContextMoveToPoint(cgContextRef, 0, mouseMovedPoint_.y);
- CGContextAddLineToPoint(cgContextRef, 1000, mouseMovedPoint_.y);
-
- CGContextDrawPath(cgContextRef, kCGPathStroke);
-}
-
-@end
diff --git a/tests/manual/cocoa/qmaccocoaviewcontainer/main.mm b/tests/manual/cocoa/qmaccocoaviewcontainer/main.mm
deleted file mode 100644
index 8b05b64a1e..0000000000
--- a/tests/manual/cocoa/qmaccocoaviewcontainer/main.mm
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2016 The Qt Company Ltd.
- ** Contact: https://www.qt.io/licensing/
- **
- ** This file is part of the test suite of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and The Qt Company. For licensing terms
- ** and conditions see https://www.qt.io/terms-conditions. For further
- ** information use the contact form at https://www.qt.io/contact-us.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3 as published by the Free Software
- ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
- ** included in the packaging of this file. Please review the following
- ** information to ensure the GNU General Public License requirements will
- ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-
-#import "TestMouseMovedNSView.h"
-#include <QtGui>
-#include <QtWidgets>
-#include <QMacCocoaViewContainer>
-
-class MyWidget : public QWidget
-{
- Q_OBJECT
-public:
- MyWidget(QMacCocoaViewContainer *c, QWidget *parent = 0) : QWidget(parent), container(c), currentlyVisible(true)
- {
- QVBoxLayout *vbox = new QVBoxLayout;
- QLabel *label = new QLabel("1: Check that the cross hairs move when the mouse is moved over the widget\n"
- "2: Check that clicking on change visibility causes the NSView to hide/show as appropriate\n"
- "3: Check that clicking on resize makes the view be 200x200");
- vbox->addWidget(label);
- QPushButton *button = new QPushButton("Change visibility");
- connect(button, SIGNAL(clicked()), this, SLOT(changeVisibility()));
- vbox->addWidget(button);
- button = new QPushButton("Change size");
- connect(button, SIGNAL(clicked()), this, SLOT(changeSize()));
- vbox->addWidget(button);
- setLayout(vbox);
- }
-public slots:
- void changeVisibility()
- {
- currentlyVisible = !currentlyVisible;
- if (!currentlyVisible)
- container->hide();
- else
- container->show();
- bool b = !([(NSView *)container->cocoaView() isHidden]);
- QMessageBox::information(this, "Is visible", QString("NSView visibility: %1").arg(b));
- }
- void changeSize()
- {
- NSRect r = NSMakeRect(0, 0, 200, 200);
- [(NSView *)container->cocoaView() setFrame:r];
- }
-private:
- QMacCocoaViewContainer *container;
- bool currentlyVisible;
-};
-
-#include "main.moc"
-
-int main(int argc, char **argv)
-{
- QApplication a(argc, argv);
- QPoint pos(100,100);
- QWidget w;
- w.move(pos);
- w.resize(300, 300);
- w.setWindowTitle("QMacCocoaViewContainer");
- NSRect r = NSMakeRect(0, 0, 100, 100);
- NSView *view = [[TestMouseMovedNSView alloc] initWithFrame:r];
- QMacCocoaViewContainer *nativeChild = new QMacCocoaViewContainer(view, &w);
- QVBoxLayout *vbox = new QVBoxLayout;
- vbox->addWidget(nativeChild);
- w.setLayout(vbox);
- w.show();
- MyWidget w2(nativeChild);
- w2.show();
- return a.exec();
-}
-
diff --git a/tests/manual/cocoa/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro b/tests/manual/cocoa/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro
deleted file mode 100644
index 1d1eb08253..0000000000
--- a/tests/manual/cocoa/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-TARGET = qmaccocoaviewcontainer
-INCLUDEPATH += .
-QT += widgets
-LIBS += -framework AppKit
-# Input
-OBJECTIVE_SOURCES += main.mm TestMouseMovedNSView.m
-HEADERS += TestMouseMovedNSView.h