Just some more on QWindow. Nothing works

(cherry picked from commit 3acf7aa979630a57791e2a039b1b7b0b85b0aac8)
This commit is contained in:
Jørgen Lind 2011-04-26 09:56:43 +02:00 committed by Samuel Rødal
parent fee009bcf9
commit 498f938f2d
6 changed files with 458 additions and 94 deletions

View File

@ -210,7 +210,7 @@ embedded {
qpa {
HEADERS += \
kernel/qgenericpluginfactory_qpa.h \
kernel/qgenericpluginfactory_qpa.h \
kernel/qgenericplugin_qpa.h \
kernel/qeventdispatcher_qpa_p.h \
kernel/qwindowsysteminterface_qpa.h \
@ -226,17 +226,18 @@ qpa {
kernel/qplatformeventloopintegration_qpa.h \
kernel/qplatformcursor_qpa.h \
kernel/qplatformclipboard_qpa.h \
kernel/qplatformnativeinterface_qpa.h
kernel/qplatformnativeinterface_qpa.h \
kernel/qwindow_qpa.cpp
SOURCES += \
kernel/qapplication_qpa.cpp \
kernel/qclipboard_qpa.cpp \
kernel/qcursor_qpa.cpp \
kernel/qdnd_qws.cpp \
kernel/qdesktopwidget_qpa.cpp \
kernel/qgenericpluginfactory_qpa.cpp \
kernel/qgenericplugin_qpa.cpp \
kernel/qkeymapper_qws.cpp \
kernel/qapplication_qpa.cpp \
kernel/qclipboard_qpa.cpp \
kernel/qcursor_qpa.cpp \
kernel/qdnd_qws.cpp \
kernel/qdesktopwidget_qpa.cpp \
kernel/qgenericpluginfactory_qpa.cpp \
kernel/qgenericplugin_qpa.cpp \
kernel/qkeymapper_qws.cpp \
kernel/qwidget_qpa.cpp \
kernel/qeventdispatcher_qpa.cpp \
kernel/qwindowsysteminterface_qpa.cpp \
@ -251,7 +252,8 @@ qpa {
kernel/qplatformcursor_qpa.cpp \
kernel/qplatformclipboard_qpa.cpp \
kernel/qplatformnativeinterface_qpa.cpp \
kernel/qsessionmanager_qpa.cpp
kernel/qsessionmanager_qpa.cpp \
kernel/qwindow_qpa.cpp
contains(QT_CONFIG, glib) {
SOURCES += \

View File

@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QPlatformWindow;
class QWindowSurface;
class QWindow;
class QBlittable;
class QWidget;
class QPlatformEventLoopIntegration;
@ -62,6 +62,7 @@ class QPlatformFontDatabase;
class QPlatformClipboard;
class QPlatformNativeInterface;
class Q_GUI_EXPORT QPlatformIntegration
{
public:
@ -76,8 +77,8 @@ public:
// GraphicsSystem functions
virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0;
virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0;
virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0;
virtual QPlatformWindow *createPlatformWindow(QWindow *window, const QWindowFormat &format) const = 0;
virtual QWindowSurface *createWindowSurface(QWindow *window, WId winId) const = 0;
// Window System functions
virtual QList<QPlatformScreen *> screens() const = 0;

View File

@ -0,0 +1,305 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qwindow_qpa.h"
#include "qplatformwindow_qpa.h"
#include "qwindowformat_qpa.h"
#include "qapplication_p.h"
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
class QWindowPrivate : public QObjectPrivate{
QWindowPrivate(const QWindowFormat &requestedFormat)
: QObjectPrivate()
, platformWindow(0)
, requestedFormat(requestedFormat)
, glContext(0)
{
}
~QWindowPrivate()
{
}
private:
QPlatformWindow *platformWindow;
QWindowFormat requestedFormat;
QString windowTitle;
QRect geometry;
QGLContext *glContext;
};
QWindow::QWindow(const QWindowFormat &format, QWindow *parent)
: QObject(*new QWindowPrivate(format), parent)
{
}
void QWindow::setVisible(bool visible)
{
Q_D(QWindow);
if (!d->platformWindow) {
create();
}
d->platformWindow->setVisible(visible);
}
void QWindow::create()
{
Q_D(QWindow);
d->platformWindow = QApplicationPrivate::platformIntegration()->createPlatformWindow(this,d->requestedFormat);
Q_ASSERT(d->platformWindow);
}
WId QWindow::winId() const
{
Q_D(QWindow);
if(d->platformWindow) {
return d->platformWindow->winId();
}
return 0;
}
void QWindow::setParent(const QWindow *parent)
{
Q_D(QWindow);
//How should we support lazy init when setting parent
if (!parent->d_func()->platformWindow) {
parent->create();
}
if(!d->platformWindow) {
create();
}
d->platformWindow->setParent(parent->d_func()->platformWindow);
}
void QWindow::setWindowTitle(const QString &title)
{
Q_D(QWindow);
d->windowTitle = title;
if (d->platformWindow) {
d->platformWindow->setWindowTitle(title);
}
}
QString QWindow::windowTitle() const
{
Q_D(const QWindow);
return d->windowTitle;
}
void QWindow::raise()
{
Q_D(QWindow);
if (d->platformWindow) {
d->platformWindow->raise();
}
}
void QWindow::lower()
{
Q_D(QWindow);
if (d->platformWindow) {
d->platformWindow->lower();
}
}
void QWindow::setOpacity(qreal level)
{
Q_D(QWindow);
if (d->platformWindow) {
d->platformWindow->setOpacity(level);
}
}
void QWindow::requestActivateWindow()
{
Q_D(QWindow);
if (d->platformWindow) {
d->platformWindow->requestActivateWindow();
}
}
Qt::WindowStates QWindow::windowState() const
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::setWindowState(Qt::WindowStates state)
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
QSize QWindow::minimumSize() const
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
QSize QWindow::maximumSize() const
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::setMinimumSize(const QSize &size) const
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::setMaximumSize(const QSize &size) const
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::setGeometry(const QRect &rect)
{
Q_D(QWindow);
d->geometry = rect;
if (d->platformWindow) {
d->platformWindow->setGeometry(rect);
}
}
QRect QWindow::geometry() const
{
Q_D(const QWindow);
return d->geometry;
}
void QWindow::setWindowIcon(const QImage &icon) const
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
QGLContext * QWindow::glContext() const
{
Q_D(QWindow);
return d->glContext;
}
void QWindow::showMinimized()
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::showMaximized()
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::showFullScreen()
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::showNormal()
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
bool QWindow::close()
{
//should we have close?
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::resizeEvent(QResizeEvent *)
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::showEvent(QShowEvent *)
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::hideEvent(QHideEvent *)
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
bool QWindow::event(QEvent *)
{
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
void QWindow::keyPressEvent(QKeyEvent *)
{
}
void QWindow::keyReleaseEvent(QKeyEvent *)
{
}
void QWindow::inputMethodEvent(QInputMethodEvent *)
{
}
void QWindow::mousePressEvent(QMouseEvent *)
{
}
void QWindow::mouseReleaseEvent(QMouseEvent *)
{
}
void QWindow::mouseDoubleClickEvent(QMouseEvent *)
{
}
void QWindow::mouseMoveEvent(QMouseEvent *)
{
}
#ifndef QT_NO_WHEELEVENT
void QWindow::wheelEvent(QWheelEvent *)
{
}
#endif //QT_NO_WHEELEVENT
QT_END_NAMESPACE

View File

@ -0,0 +1,136 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWINDOW_QPA_H
#define QWINDOW_QPA_H
#include <QObject>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QWindowPrivate;
class QGLContext;
class Q_GUI_EXPORT QWindow : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWindow)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
public:
QWindow(const QWindowFormat &format, QWindow *parent);
void setVisible(bool visible);
void create();
WId winId() const;
void setParent(const QWindow *parent);
QString windowTitle() const;
void setOpacity(qreal level);
void requestActivateWindow();
Qt::WindowStates windowState() const;
void setWindowState(Qt::WindowStates state);
QSize minimumSize() const;
QSize maximumSize() const;
void setMinimumSize(const QSize &size) const;
void setMaximumSize(const QSize &size) const;
void setGeometry(const QRect &rect);
QRect geometry() const;
void setWindowIcon(const QImage &icon) const;
QGLContext *glContext() const;
public Q_SLOTS:
inline void show() { setVisible(true); }
inline void hide() { setVisible(false); }
void showMinimized();
void showMaximized();
void showFullScreen();
void showNormal();
bool close();
void raise();
void lower();
void setWindowTitle(const QString &);
Q_SIGNALS:
void backBufferReady();
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
virtual bool event(QEvent *);
virtual void keyPressEvent(QKeyEvent *);
virtual void keyReleaseEvent(QKeyEvent *);
virtual void inputMethodEvent(QInputMethodEvent *);
virtual void mousePressEvent(QMouseEvent *);
virtual void mouseReleaseEvent(QMouseEvent *);
virtual void mouseDoubleClickEvent(QMouseEvent *);
virtual void mouseMoveEvent(QMouseEvent *);
#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *);
#endif
private:
Q_DISABLE_COPY(QWindow)
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QWINDOW_QPA_H

View File

@ -51,86 +51,6 @@ QT_MODULE(Gui)
class QWindowFormatPrivate;
class QWindowPrivate;
class Q_GUI_EXPORT QWindow : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWindow)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
public:
void setVisible(bool visible);
WId winId() const;
void setParent(const QWindow *window);
void setWindowTitle(const QString &title);
void raise();
void lower();
void setOpacity(qreal level);
void requestActivateWindow();
Qt::WindowStates windowState() const;
void setWindowState(Qt::WindowStates state);
QSize minimumSize() const;
QSize maximumSize() const;
void setMinimumSize(const QSize &size) const;
void setMaximumSize(const QSize &size) const;
void setGeometry(const QRect &rect);
QRect geometry() const;
QString windowTitle() const;
void setWindowIcon(const QImage &icon) const;
QGLContext *glContext() const;
public Q_SLOTS:
inline void show() { setVisible(true); }
inline void hide() { setVisible(false); }
void showMinimized();
void showMaximized();
void showFullScreen();
void showNormal();
bool close();
void raise();
void lower();
void setWindowTitle(const QString &);
Q_SIGNALS:
void backBufferReady();
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
virtual bool event(QEvent *);
virtual void keyPressEvent(QKeyEvent *);
virtual void keyReleaseEvent(QKeyEvent *);
virtual void inputMethodEvent(QInputMethodEvent *);
virtual void mousePressEvent(QMouseEvent *);
virtual void mouseReleaseEvent(QMouseEvent *);
virtual void mouseDoubleClickEvent(QMouseEvent *);
virtual void mouseMoveEvent(QMouseEvent *);
#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *);
#endif
private:
Q_DISABLE_COPY(QWindow)
};
class Q_GUI_EXPORT QWindowFormat
{
public: