From 795400d1e5bc73769de990c69d6c864f7b148b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 27 Jan 2015 14:13:39 +0100 Subject: Clean up qt_on_cocoa manual test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Focus the test on embedding QWindow: Remove the NSToolBar code. Use standard NSApplication startup code. Use winId() to access the NSView instead of QPlatformNativeInterface (which is gui-private). Rename Window -> RasterWindow. Change-Id: Ie98cb73020d2721743bb665b89b17f07f2bf984b Reviewed-by: Morten Johan Sørvig --- tests/manual/cocoa/qt_on_cocoa/main.mm | 168 ++++---------------- tests/manual/cocoa/qt_on_cocoa/qt_on_cocoa.pro | 10 +- tests/manual/cocoa/qt_on_cocoa/rasterwindow.cpp | 188 +++++++++++++++++++++++ tests/manual/cocoa/qt_on_cocoa/rasterwindow.h | 65 ++++++++ tests/manual/cocoa/qt_on_cocoa/window.cpp | 195 ------------------------ tests/manual/cocoa/qt_on_cocoa/window.h | 66 -------- 6 files changed, 288 insertions(+), 404 deletions(-) create mode 100644 tests/manual/cocoa/qt_on_cocoa/rasterwindow.cpp create mode 100644 tests/manual/cocoa/qt_on_cocoa/rasterwindow.h delete mode 100644 tests/manual/cocoa/qt_on_cocoa/window.cpp delete mode 100644 tests/manual/cocoa/qt_on_cocoa/window.h (limited to 'tests/manual/cocoa') diff --git a/tests/manual/cocoa/qt_on_cocoa/main.mm b/tests/manual/cocoa/qt_on_cocoa/main.mm index 5dd546479e..23370b0305 100644 --- a/tests/manual/cocoa/qt_on_cocoa/main.mm +++ b/tests/manual/cocoa/qt_on_cocoa/main.mm @@ -31,123 +31,35 @@ ** ****************************************************************************/ -#include -#include +#include "rasterwindow.h" +#include #include -#include -#include - -#include - -#include "window.h" #include - -@interface FilledView : NSView -{ - +@interface AppDelegate : NSObject { + QGuiApplication *m_app; + QWindow *m_window; } +- (AppDelegate *) initWithArgc:(int)argc argv:(const char **)argv; +- (void) applicationWillFinishLaunching: (NSNotification *)notification; +- (void)applicationWillTerminate:(NSNotification *)notification; @end -@implementation FilledView - -- (void)drawRect:(NSRect)dirtyRect { - // set any NSColor for filling, say white: - [[NSColor redColor] setFill]; - NSRectFill(dirtyRect); -} - -@end - -@interface QtMacToolbarDelegate : NSObject +@implementation AppDelegate +- (AppDelegate *) initWithArgc:(int)argc argv:(const char **)argv { -@public - NSToolbar *toolbar; -} - -- (id)init; -- (NSToolbarItem *) toolbar: (NSToolbar *)toolbar itemForItemIdentifier: (NSString *) itemIdent willBeInsertedIntoToolbar:(BOOL) willBeInserted; -- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)tb; -- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar; -- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar; -@end - -@implementation QtMacToolbarDelegate - -- (id)init -{ - self = [super init]; - if (self) { - } + m_app = new QGuiApplication(argc, const_cast(argv)); return self; } -- (void)dealloc -{ - [super dealloc]; -} - -- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)tb -{ - Q_UNUSED(tb); - NSMutableArray *array = [[[NSMutableArray alloc] init] autorelease]; -// [array addObject : NSToolbarPrintItemIdentifier]; -// [array addObject : NSToolbarShowColorsItemIdentifier]; - [array addObject : @"filledView"]; - return array; -} - -- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)tb -{ - Q_UNUSED(tb); - NSMutableArray *array = [[[NSMutableArray alloc] init] autorelease]; -// [array addObject : NSToolbarPrintItemIdentifier]; -// [array addObject : NSToolbarShowColorsItemIdentifier]; - [array addObject : @"filledView"]; - return array; -} - -- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)tb -{ - Q_UNUSED(tb); - NSMutableArray *array = [[[NSMutableArray alloc] init] autorelease]; - return array; -} - -- (IBAction)itemClicked:(id)sender +- (void) applicationWillFinishLaunching: (NSNotification *)notification { + Q_UNUSED(notification); -} - -- (NSToolbarItem *) toolbar: (NSToolbar *)tb itemForItemIdentifier: (NSString *) itemIdentifier willBeInsertedIntoToolbar:(BOOL) willBeInserted -{ - Q_UNUSED(tb); - Q_UNUSED(willBeInserted); - //const QString identifier = toQString(itemIdentifier); - //NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdentifier] autorelease]; - //return toolbarItem; - - //NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdentifier] autorelease]; - NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdentifier] autorelease]; - FilledView *theView = [[FilledView alloc] init]; - [toolbarItem setView : theView]; - [toolbarItem setMinSize : NSMakeSize(400, 40)]; - [toolbarItem setMaxSize : NSMakeSize(4000, 40)]; - return toolbarItem; -} -@end - -@interface WindowAndViewAndQtCreator : NSObject {} -- (void)createWindowAndViewAndQt; -@end - -@implementation WindowAndViewAndQtCreator -- (void)createWindowAndViewAndQt { - - // Create the window + // Create the NSWindow NSRect frame = NSMakeRect(500, 500, 500, 500); NSWindow* window = [[NSWindow alloc] initWithContentRect:frame styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask @@ -156,49 +68,31 @@ NSString *title = @"This the NSWindow window"; [window setTitle:title]; - [window setBackgroundColor:[NSColor blueColor]]; - // Create a tool bar, set Qt delegate - NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier : @"foobartoolbar"]; - QtMacToolbarDelegate *delegate = [[QtMacToolbarDelegate alloc] init]; - [toolbar setDelegate : delegate]; - [window setToolbar : toolbar]; - - // Create the QWindow, don't show it. - Window *qtWindow = new Window(); - qtWindow->create(); - - //QSGView *qtWindow = new QSGView(); - //qtWindow->setSource(QUrl::fromLocalFile("/Users/msorvig/code/qt5/qtdeclarative/examples/declarative/samegame/samegame.qml")); - // qtWindow->setWindowFlags(Qt::WindowType(13)); // 13: NativeEmbeddedWindow - - // Get the nsview from the QWindow, set it as the content view - // on the NSWindow created above. - QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface(); - NSView *qtView = (NSView *)platformNativeInterface->nativeResourceForWindow("nsview", qtWindow); - [window setContentView:qtView]; + // Create the QWindow, use its NSView as the content view + m_window = new RasterWindow(); + [window setContentView:reinterpret_cast(m_window->winId())]; + + // Show the NSWindow [window makeKeyAndOrderFront:NSApp]; } -@end -int main(int argc, char *argv[]) +- (void)applicationWillTerminate:(NSNotification *)notification { - QGuiApplication app(argc, argv); - - // fake NSApplicationMain() implementation follows: - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - [NSApplication sharedApplication]; + Q_UNUSED(notification); + delete m_window; + delete m_app; +} - // schedule call to create the UI. - WindowAndViewAndQtCreator *windowAndViewAndQtCreator= [WindowAndViewAndQtCreator alloc]; - [NSTimer scheduledTimerWithTimeInterval:0 target:windowAndViewAndQtCreator selector:@selector(createWindowAndViewAndQt) userInfo:nil repeats:NO]; +@end - [(NSApplication *)NSApp run]; - [NSApp release]; - [pool release]; - exit(0); - return 0; +int main(int argc, const char *argv[]) +{ + // Create NSApplicaiton with delgate + NSApplication *app =[NSApplication sharedApplication]; + app.delegate = [[AppDelegate alloc] initWithArgc:argc argv:argv]; + return NSApplicationMain (argc, argv); } diff --git a/tests/manual/cocoa/qt_on_cocoa/qt_on_cocoa.pro b/tests/manual/cocoa/qt_on_cocoa/qt_on_cocoa.pro index 3d526909a5..97e4473e15 100644 --- a/tests/manual/cocoa/qt_on_cocoa/qt_on_cocoa.pro +++ b/tests/manual/cocoa/qt_on_cocoa/qt_on_cocoa.pro @@ -1,13 +1,11 @@ TEMPLATE = app OBJECTIVE_SOURCES += main.mm -HEADERS += window.h -SOURCES += window.cpp +HEADERS += rasterwindow.h +SOURCES += rasterwindow.cpp LIBS += -framework Cocoa -QMAKE_INFO_PLIST = Info_mac.plist -OTHER_FILES = Info_mac.plist -QT += gui widgets widgets-private gui-private core-private +QT += gui widgets quick -QT += declarative +QT += quick DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/manual/cocoa/qt_on_cocoa/rasterwindow.cpp b/tests/manual/cocoa/qt_on_cocoa/rasterwindow.cpp new file mode 100644 index 0000000000..9b8f5e63ce --- /dev/null +++ b/tests/manual/cocoa/qt_on_cocoa/rasterwindow.cpp @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "rasterwindow.h" + +//#include + +#include +#include +#include + +static int colorIndexId = 0; + +QColor colorTable[] = +{ + QColor("#f09f8f"), + QColor("#a2bff2"), + QColor("#c0ef8f") +}; + +RasterWindow::RasterWindow(QRasterWindow *parent) + : QRasterWindow(parent) + , m_backgroundColorIndex(colorIndexId++) +{ + initialize(); +} + +void RasterWindow::initialize() +{ + if (parent()) + setGeometry(QRect(160, 120, 320, 240)); + else { + setGeometry(QRect(10, 10, 640, 480)); + + setSizeIncrement(QSize(10, 10)); + setBaseSize(QSize(640, 480)); + setMinimumSize(QSize(240, 160)); + setMaximumSize(QSize(800, 600)); + } + + create(); + m_backingStore = new QBackingStore(this); + + m_image = QImage(geometry().size(), QImage::Format_RGB32); + m_image.fill(colorTable[m_backgroundColorIndex % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba()); + + m_lastPos = QPoint(-1, -1); + m_renderTimer = 0; +} + +void RasterWindow::mousePressEvent(QMouseEvent *event) +{ + m_lastPos = event->pos(); +} + +void RasterWindow::mouseMoveEvent(QMouseEvent *event) +{ + if (m_lastPos != QPoint(-1, -1)) { + QPainter p(&m_image); + p.setRenderHint(QPainter::Antialiasing); + p.drawLine(m_lastPos, event->pos()); + m_lastPos = event->pos(); + } + + scheduleRender(); +} + +void RasterWindow::mouseReleaseEvent(QMouseEvent *event) +{ + if (m_lastPos != QPoint(-1, -1)) { + QPainter p(&m_image); + p.setRenderHint(QPainter::Antialiasing); + p.drawLine(m_lastPos, event->pos()); + m_lastPos = QPoint(-1, -1); + } + + scheduleRender(); +} + +void RasterWindow::exposeEvent(QExposeEvent *) +{ + scheduleRender(); +} + +void RasterWindow::resizeEvent(QResizeEvent *) +{ + QImage old = m_image; + + //qDebug() << "RasterWindow::resizeEvent" << width << height; + + int width = qMax(geometry().width(), old.width()); + int height = qMax(geometry().height(), old.height()); + + if (width > old.width() || height > old.height()) { + m_image = QImage(width, height, QImage::Format_RGB32); + m_image.fill(colorTable[(m_backgroundColorIndex) % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba()); + + QPainter p(&m_image); + p.drawImage(0, 0, old); + } + + render(); +} + +void RasterWindow::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Backspace: + m_text.chop(1); + break; + case Qt::Key_Enter: + case Qt::Key_Return: + m_text.append('\n'); + break; + default: + m_text.append(event->text()); + break; + } + scheduleRender(); +} + +void RasterWindow::scheduleRender() +{ + if (!m_renderTimer) + m_renderTimer = startTimer(1); +} + +void RasterWindow::timerEvent(QTimerEvent *) +{ + render(); + killTimer(m_renderTimer); + m_renderTimer = 0; +} + +void RasterWindow::render() +{ + QRect rect(QPoint(), geometry().size()); + + m_backingStore->resize(rect.size()); + + m_backingStore->beginPaint(rect); + + QPaintDevice *device = m_backingStore->paintDevice(); + + QPainter p(device); + p.drawImage(0, 0, m_image); + + QFont font; + font.setPixelSize(32); + + p.setFont(font); + p.drawText(rect, 0, m_text); + + m_backingStore->endPaint(); + m_backingStore->flush(rect); +} + + diff --git a/tests/manual/cocoa/qt_on_cocoa/rasterwindow.h b/tests/manual/cocoa/qt_on_cocoa/rasterwindow.h new file mode 100644 index 0000000000..1de66b5302 --- /dev/null +++ b/tests/manual/cocoa/qt_on_cocoa/rasterwindow.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +class RasterWindow : public QRasterWindow +{ +public: + RasterWindow(QRasterWindow *parent = 0); + +protected: + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + + void keyPressEvent(QKeyEvent *); + + void exposeEvent(QExposeEvent *); + void resizeEvent(QResizeEvent *); + + void timerEvent(QTimerEvent *); + +private: + void render(); + void scheduleRender(); + void initialize(); + + QString m_text; + QImage m_image; + QPoint m_lastPos; + int m_backgroundColorIndex; + QBackingStore *m_backingStore; + int m_renderTimer; +}; diff --git a/tests/manual/cocoa/qt_on_cocoa/window.cpp b/tests/manual/cocoa/qt_on_cocoa/window.cpp deleted file mode 100644 index 9929a50065..0000000000 --- a/tests/manual/cocoa/qt_on_cocoa/window.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "window.h" - -#include - -#include -#include -#include - -static int colorIndexId = 0; - -QColor colorTable[] = -{ - QColor("#f09f8f"), - QColor("#a2bff2"), - QColor("#c0ef8f") -}; - -Window::Window(QScreen *screen) - : QWindow(screen) - , m_backgroundColorIndex(colorIndexId++) -{ - initialize(); -} - -Window::Window(QWindow *parent) - : QWindow(parent) - , m_backgroundColorIndex(colorIndexId++) -{ - initialize(); -} - -void Window::initialize() -{ - if (parent()) - setGeometry(QRect(160, 120, 320, 240)); - else { - setGeometry(QRect(10, 10, 640, 480)); - - setSizeIncrement(QSize(10, 10)); - setBaseSize(QSize(640, 480)); - setMinimumSize(QSize(240, 160)); - setMaximumSize(QSize(800, 600)); - } - - create(); - m_backingStore = new QBackingStore(this); - - m_image = QImage(geometry().size(), QImage::Format_RGB32); - m_image.fill(colorTable[m_backgroundColorIndex % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba()); - - m_lastPos = QPoint(-1, -1); - m_renderTimer = 0; -} - -void Window::mousePressEvent(QMouseEvent *event) -{ - m_lastPos = event->pos(); -} - -void Window::mouseMoveEvent(QMouseEvent *event) -{ - if (m_lastPos != QPoint(-1, -1)) { - QPainter p(&m_image); - p.setRenderHint(QPainter::Antialiasing); - p.drawLine(m_lastPos, event->pos()); - m_lastPos = event->pos(); - } - - scheduleRender(); -} - -void Window::mouseReleaseEvent(QMouseEvent *event) -{ - if (m_lastPos != QPoint(-1, -1)) { - QPainter p(&m_image); - p.setRenderHint(QPainter::Antialiasing); - p.drawLine(m_lastPos, event->pos()); - m_lastPos = QPoint(-1, -1); - } - - scheduleRender(); -} - -void Window::exposeEvent(QExposeEvent *) -{ - scheduleRender(); -} - -void Window::resizeEvent(QResizeEvent *) -{ - QImage old = m_image; - - //qDebug() << "Window::resizeEvent" << width << height; - - int width = qMax(geometry().width(), old.width()); - int height = qMax(geometry().height(), old.height()); - - if (width > old.width() || height > old.height()) { - m_image = QImage(width, height, QImage::Format_RGB32); - m_image.fill(colorTable[(m_backgroundColorIndex) % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba()); - - QPainter p(&m_image); - p.drawImage(0, 0, old); - } - - render(); -} - -void Window::keyPressEvent(QKeyEvent *event) -{ - switch (event->key()) { - case Qt::Key_Backspace: - m_text.chop(1); - break; - case Qt::Key_Enter: - case Qt::Key_Return: - m_text.append('\n'); - break; - default: - m_text.append(event->text()); - break; - } - scheduleRender(); -} - -void Window::scheduleRender() -{ - if (!m_renderTimer) - m_renderTimer = startTimer(1); -} - -void Window::timerEvent(QTimerEvent *) -{ - render(); - killTimer(m_renderTimer); - m_renderTimer = 0; -} - -void Window::render() -{ - QRect rect(QPoint(), geometry().size()); - - m_backingStore->resize(rect.size()); - - m_backingStore->beginPaint(rect); - - QPaintDevice *device = m_backingStore->paintDevice(); - - QPainter p(device); - p.drawImage(0, 0, m_image); - - QFont font; - font.setPixelSize(32); - - p.setFont(font); - p.drawText(rect, 0, m_text); - - m_backingStore->endPaint(); - m_backingStore->flush(rect); -} - - diff --git a/tests/manual/cocoa/qt_on_cocoa/window.h b/tests/manual/cocoa/qt_on_cocoa/window.h deleted file mode 100644 index a36180e0f3..0000000000 --- a/tests/manual/cocoa/qt_on_cocoa/window.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -class Window : public QWindow -{ -public: - Window(QWindow *parent = 0); - Window(QScreen *screen); - -protected: - void mousePressEvent(QMouseEvent *); - void mouseMoveEvent(QMouseEvent *); - void mouseReleaseEvent(QMouseEvent *); - - void keyPressEvent(QKeyEvent *); - - void exposeEvent(QExposeEvent *); - void resizeEvent(QResizeEvent *); - - void timerEvent(QTimerEvent *); - -private: - void render(); - void scheduleRender(); - void initialize(); - - QString m_text; - QImage m_image; - QPoint m_lastPos; - int m_backgroundColorIndex; - QBackingStore *m_backingStore; - int m_renderTimer; -}; -- cgit v1.2.3