Support QQuickWidget on Windows.

Task-number: QTBUG-36887

Change-Id: Ifb03804e21fd82d7eae2942b9e8ca83f1bdb776c
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
bb10
Friedemann Kleint 2014-02-28 17:10:55 +01:00 committed by The Qt Project
parent b22ef59663
commit 21114bcc1f
4 changed files with 25 additions and 1 deletions

View File

@ -203,4 +203,17 @@ HDC QWindowsBackingStore::getDC() const
return 0;
}
#ifndef QT_NO_OPENGL
QImage QWindowsBackingStore::toImage() const
{
if (m_image.isNull()) {
qCWarning(lcQpaBackingStore) <<__FUNCTION__ << "Image is null.";
return QImage();
}
return m_image.data()->image();
}
#endif // !QT_NO_OPENGL
QT_END_NAMESPACE

View File

@ -67,6 +67,10 @@ public:
HDC getDC() const;
#ifndef QT_NO_OPENGL
QImage toImage() const Q_DECL_OVERRIDE;
#endif
private:
QScopedPointer<QWindowsNativeImage> m_image;
};

View File

@ -245,6 +245,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
return true;
case ForeignWindows:
return true;
case RasterGLSurface:
return true;
default:
return QPlatformIntegration::hasCapability(cap);
}

View File

@ -69,13 +69,18 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc
QWindowsWindow *bw = static_cast<QWindowsWindow *>(window->handle());
if (resource == "handle")
return bw->handle();
if (window->surfaceType() == QWindow::RasterSurface) {
switch (window->surfaceType()) {
case QWindow::RasterSurface:
case QWindow::RasterGLSurface:
if (resource == "getDC")
return bw->getDC();
if (resource == "releaseDC") {
bw->releaseDC();
return 0;
}
break;
case QWindow::OpenGLSurface:
break;
}
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
return 0;