summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp12
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp6
-rw-r--r--src/plugins/bearer/symbian/symbian.pro1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp23
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h3
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp89
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h3
-rw-r--r--src/plugins/imageformats/tiff/tiff.pro5
-rw-r--r--src/plugins/plugins.pro2
-rw-r--r--src/plugins/qdeclarativemodules/multimedia/multimedia.cpp (renamed from src/plugins/qmlmodules/multimedia/multimedia.cpp)20
-rw-r--r--src/plugins/qdeclarativemodules/multimedia/multimedia.pro15
-rw-r--r--src/plugins/qdeclarativemodules/qdeclarativemodules.pro (renamed from src/plugins/qmlmodules/qmlmodules.pro)2
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp260
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h226
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp40
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h68
-rw-r--r--src/plugins/qdeclarativemodules/widgets/widgets.cpp138
-rw-r--r--src/plugins/qdeclarativemodules/widgets/widgets.pro20
-rw-r--r--src/plugins/qmlmodules/multimedia/multimedia.pro11
19 files changed, 861 insertions, 83 deletions
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index e96b80c..e6c871d 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -63,6 +63,7 @@
#include <unistd.h>
#endif
+QT_BEGIN_NAMESPACE
static QString qGetInterfaceType(const QString &interface)
{
@@ -126,14 +127,11 @@ static QString qGetInterfaceType(const QString &interface)
ifreq request;
strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name));
- if (ioctl(sock, SIOCGIFHWADDR, &request) >= 0) {
- switch (request.ifr_hwaddr.sa_family) {
- case ARPHRD_ETHER:
- return QLatin1String("Ethernet");
- }
- }
-
+ int result = ioctl(sock, SIOCGIFHWADDR, &request);
close(sock);
+
+ if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER)
+ return QLatin1String("Ethernet");
#else
Q_UNUSED(interface);
#endif
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index a9e93e0..e7c56a2 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -1080,14 +1080,14 @@ QString QNetworkSessionPrivateImpl::errorString() const
QString errorStr;
switch(q->error()) {
case QNetworkSession::RoamingError:
- errorStr = QObject::tr("Roaming error");
+ errorStr = QNetworkSessionPrivateImpl::tr("Roaming error");
break;
case QNetworkSession::SessionAbortedError:
- errorStr = QObject::tr("Session aborted by user or system");
+ errorStr = QNetworkSessionPrivateImpl::tr("Session aborted by user or system");
break;
default:
case QNetworkSession::UnknownSessionError:
- errorStr = QObject::tr("Unidentified Error");
+ errorStr = QNetworkSessionPrivateImpl::tr("Unidentified Error");
break;
}
return errorStr;
diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro
index 9fd1a74..9613def 100644
--- a/src/plugins/bearer/symbian/symbian.pro
+++ b/src/plugins/bearer/symbian/symbian.pro
@@ -21,6 +21,7 @@ exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) {
}
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+symbian-abld:INCLUDEPATH += $$QT_BUILD_TREE/include/QtNetwork/private
LIBS += -lcommdb \
-lapsettingshandlerui \
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index cd4d5c2..cffd4e3 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -1126,6 +1126,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
if (displayArgs.contains(QLatin1String("boundingrectflip"), Qt::CaseInsensitive)) {
d_ptr->directFBFlags |= BoundingRectFlip;
+ } else if (displayArgs.contains(QLatin1String("nopartialflip"), Qt::CaseInsensitive)) {
+ d_ptr->directFBFlags |= NoPartialFlip;
}
#ifdef QT_DIRECTFB_IMAGECACHE
@@ -1139,6 +1141,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#endif
d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN);
+ const bool forcePremultiplied = displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive);
+
DFBSurfaceDescription description;
memset(&description, 0, sizeof(DFBSurfaceDescription));
IDirectFBSurface *surface;
@@ -1167,7 +1171,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
description.caps |= capabilities[i].cap;
}
- if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) {
+ if (forcePremultiplied) {
description.caps |= DSCAPS_PREMULTIPLIED;
}
@@ -1217,6 +1221,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied;
break;
case QImage::Format_ARGB32:
+ if (forcePremultiplied)
+ d_ptr->alphaPixmapFormat = pixelFormat = QImage::Format_ARGB32_Premultiplied;
case QImage::Format_ARGB32_Premultiplied:
case QImage::Format_ARGB4444_Premultiplied:
case QImage::Format_ARGB8555_Premultiplied:
@@ -1674,7 +1680,7 @@ bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *d
uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl)
{
- void *mem;
+ void *mem = 0;
const DFBResult result = surface->Lock(surface, flags, &mem, bpl);
if (result != DFB_OK) {
DirectFBError("QDirectFBScreen::lockSurface()", result);
@@ -1683,11 +1689,22 @@ uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFla
return reinterpret_cast<uchar*>(mem);
}
+static inline bool isFullUpdate(IDirectFBSurface *surface, const QRegion &region, const QPoint &offset)
+{
+ if (offset == QPoint(0, 0) && region.rectCount() == 1) {
+ QSize size;
+ surface->GetSize(surface, &size.rwidth(), &size.rheight());
+ if (region.boundingRect().size() == size)
+ return true;
+ }
+ return false;
+}
void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags,
const QRegion &region, const QPoint &offset)
{
- if (!(flipFlags & DSFLIP_BLIT)) {
+ if (d_ptr->directFBFlags & NoPartialFlip
+ || (!(flipFlags & DSFLIP_BLIT) && QT_PREPEND_NAMESPACE(isFullUpdate(surface, region, offset)))) {
surface->Flip(surface, 0, flipFlags);
} else {
if (!(d_ptr->directFBFlags & BoundingRectFlip) && region.rectCount() > 1) {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index a8c4b43..c483020 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -144,7 +144,8 @@ public:
NoFlags = 0x00,
VideoOnly = 0x01,
SystemOnly = 0x02,
- BoundingRectFlip = 0x04
+ BoundingRectFlip = 0x04,
+ NoPartialFlip = 0x08
};
Q_DECLARE_FLAGS(DirectFBFlags, DirectFBFlag);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 6764e75..a8bdb65 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -92,10 +92,6 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
mode = Offscreen;
flags = Buffered;
}
-#else
- noSystemBackground = widget && widget->testAttribute(Qt::WA_NoSystemBackground);
- if (noSystemBackground)
- flags &= ~Opaque;
#endif
setSurfaceFlags(flags);
#ifdef QT_DIRECTFB_TIMING
@@ -134,33 +130,35 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect)
if (!layer)
qFatal("QDirectFBWindowSurface: Unable to get primary display layer!");
+ updateIsOpaque();
+
DFBWindowDescription description;
memset(&description, 0, sizeof(DFBWindowDescription));
+ description.flags = DWDESC_CAPS|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT;
description.caps = DWCAPS_NODECORATION;
- description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY;
-#if (Q_DIRECTFB_VERSION >= 0x010200)
- description.flags |= DWDESC_OPTIONS;
-#endif
+ description.surface_caps = DSCAPS_NONE;
+ imageFormat = screen->pixelFormat();
- if (noSystemBackground) {
+ if (!(surfaceFlags() & Opaque)) {
+ imageFormat = screen->alphaPixmapFormat();
description.caps |= DWCAPS_ALPHACHANNEL;
#if (Q_DIRECTFB_VERSION >= 0x010200)
+ description.flags |= DWDESC_OPTIONS;
description.options |= DWOP_ALPHACHANNEL;
#endif
}
-
+ description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(imageFormat);
description.posx = rect.x();
description.posy = rect.y();
description.width = rect.width();
description.height = rect.height();
- description.surface_caps = DSCAPS_NONE;
+
+ if (QDirectFBScreen::isPremultiplied(imageFormat))
+ description.surface_caps = DSCAPS_PREMULTIPLIED;
+
if (screen->directFBFlags() & QDirectFBScreen::VideoOnly)
description.surface_caps |= DSCAPS_VIDEOONLY;
- const QImage::Format format = (noSystemBackground ? screen->alphaPixmapFormat() : screen->pixelFormat());
- description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format);
- if (QDirectFBScreen::isPremultiplied(format))
- description.surface_caps = DSCAPS_PREMULTIPLIED;
DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow);
@@ -182,7 +180,6 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect)
Q_ASSERT(!dfbSurface);
dfbWindow->GetSurface(dfbWindow, &dfbSurface);
- updateFormat();
}
static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect)
@@ -267,15 +264,17 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
}
} else { // mode == Offscreen
if (!dfbSurface) {
- dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface);
+ dfbSurface = screen->createDFBSurface(rect.size(), surfaceFlags() & Opaque ? screen->pixelFormat() : screen->alphaPixmapFormat(),
+ QDirectFBScreen::DontTrackSurface);
}
}
if (result != DFB_OK)
DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result);
#endif
}
- if (oldSurface != dfbSurface)
- updateFormat();
+ if (oldSurface != dfbSurface) {
+ imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
+ }
if (oldRect.size() != rect.size()) {
QWSWindowSurface::setGeometry(rect);
@@ -296,7 +295,7 @@ void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
if (state.size() == sizeof(this)) {
sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData());
Q_ASSERT(sibling);
- sibling->setSurfaceFlags(surfaceFlags());
+ setSurfaceFlags(sibling->surfaceFlags());
}
}
@@ -359,8 +358,6 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion &region,
const quint8 windowOpacity = quint8(win->windowOpacity() * 0xff);
const QRect windowGeometry = geometry();
#ifdef QT_DIRECTFB_WM
- const bool wasNoSystemBackground = noSystemBackground;
- noSystemBackground = win->testAttribute(Qt::WA_NoSystemBackground);
quint8 currentOpacity;
Q_ASSERT(dfbWindow);
dfbWindow->GetOpacity(dfbWindow, &currentOpacity);
@@ -368,18 +365,9 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion &region,
dfbWindow->SetOpacity(dfbWindow, windowOpacity);
}
- setOpaque(noSystemBackground || windowOpacity != 0xff);
- if (wasNoSystemBackground != noSystemBackground) {
- releaseSurface();
- dfbWindow->Release(dfbWindow);
- dfbWindow = 0;
- createWindow(windowGeometry);
- win->update();
- return;
- }
screen->flipSurface(dfbSurface, flipFlags, region, offset);
#else
- setOpaque(windowOpacity != 0xff);
+ setOpaque(windowOpacity == 0xff);
if (mode == Offscreen) {
screen->exposeRegion(region.translated(offset + geometry().topLeft()), 0);
} else {
@@ -442,11 +430,6 @@ IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget
return dfbSurface;
}
-void QDirectFBWindowSurface::updateFormat()
-{
- imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
-}
-
void QDirectFBWindowSurface::releaseSurface()
{
if (dfbSurface) {
@@ -465,9 +448,37 @@ void QDirectFBWindowSurface::releaseSurface()
}
}
+void QDirectFBWindowSurface::updateIsOpaque()
+{
+ const QWidget *win = window();
+ Q_ASSERT(win);
+ if (win->testAttribute(Qt::WA_OpaquePaintEvent) || win->testAttribute(Qt::WA_PaintOnScreen)) {
+ setOpaque(true);
+ return;
+ }
-QT_END_NAMESPACE
+ if (qFuzzyCompare(static_cast<float>(win->windowOpacity()), 1.0f)) {
+ const QPalette &pal = win->palette();
-#endif // QT_NO_QWS_DIRECTFB
+ if (win->autoFillBackground()) {
+ const QBrush &autoFillBrush = pal.brush(win->backgroundRole());
+ if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) {
+ setOpaque(true);
+ return;
+ }
+ }
+
+ if (win->isWindow() && !win->testAttribute(Qt::WA_NoSystemBackground)) {
+ const QBrush &windowBrush = win->palette().brush(QPalette::Window);
+ if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) {
+ setOpaque(true);
+ return;
+ }
+ }
+ }
+ setOpaque(false);
+}
+QT_END_NAMESPACE
+#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index 9568067..a6138f6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -97,8 +97,8 @@ public:
IDirectFBWindow *directFBWindow() const;
#endif
private:
+ void updateIsOpaque();
void setOpaque(bool opaque);
- void updateFormat();
void releaseSurface();
QDirectFBWindowSurface *sibling;
@@ -113,7 +113,6 @@ private:
#endif
DFBSurfaceFlipFlags flipFlags;
- bool noSystemBackground;
bool boundingRectFlip;
#ifdef QT_DIRECTFB_TIMING
int frames;
diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro
index 312f99c..514fd69 100644
--- a/src/plugins/imageformats/tiff/tiff.pro
+++ b/src/plugins/imageformats/tiff/tiff.pro
@@ -47,14 +47,15 @@ contains(QT_CONFIG, system-tiff) {
../../../3rdparty/libtiff/libtiff/tif_warning.c \
../../../3rdparty/libtiff/libtiff/tif_write.c \
../../../3rdparty/libtiff/libtiff/tif_zip.c
- win32 {
+ win32:!wince*: {
SOURCES += ../../../3rdparty/libtiff/libtiff/tif_win32.c
}
unix: {
SOURCES += ../../../3rdparty/libtiff/libtiff/tif_unix.c
}
wince*: {
- SOURCES += ../../../corelib/kernel/qfunctions_wince.cpp
+ SOURCES += ../../../corelib/kernel/qfunctions_wince.cpp \
+ ../../../3rdparty/libtiff/libtiff/tif_wince.c
}
symbian*: {
SOURCES += ../../../3rdparty/libtiff/port/lfind.c
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 73686bc..418fd81 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -12,6 +12,6 @@ embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers
symbian:SUBDIRS += s60
contains(QT_CONFIG, phonon): SUBDIRS *= phonon
contains(QT_CONFIG, multimedia): SUBDIRS *= audio mediaservices
-contains(QT_CONFIG, declarative): SUBDIRS *= qmlmodules
+contains(QT_CONFIG, declarative): SUBDIRS *= qdeclarativemodules
diff --git a/src/plugins/qmlmodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp
index d192ed8..8becbf3 100644
--- a/src/plugins/qmlmodules/multimedia/multimedia.cpp
+++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp
@@ -39,27 +39,19 @@
**
****************************************************************************/
-#include <QtDeclarative/qmlmoduleplugin.h>
-#include <QtDeclarative/qml.h>
-#include <QtMultimedia/multimediaqml.h>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QtMultimedia/multimediadeclarative.h>
QT_BEGIN_NAMESPACE
-class QMultimediaQmlModule : public QmlModulePlugin
+class QMultimediaQmlModule : public QDeclarativeExtensionPlugin
{
Q_OBJECT
public:
- QStringList keys() const
+ virtual void registerTypes(const char *uri)
{
- return QStringList() << QLatin1String("Qt.multimedia");
- }
-
- void defineModule(const QString& uri)
- {
- Q_UNUSED(uri)
- Q_ASSERT(uri == QLatin1String("Qt.multimedia"));
-
- QtMultimedia::qRegisterQmlElements();
+ QtMultimedia::qRegisterDeclarativeElements(uri);
}
};
diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.pro b/src/plugins/qdeclarativemodules/multimedia/multimedia.pro
new file mode 100644
index 0000000..d8ad18e
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.pro
@@ -0,0 +1,15 @@
+TARGET = multimedia
+include(../../qpluginbase.pri)
+
+QT += multimedia declarative
+
+SOURCES += multimedia.cpp
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia
+target.path = $$[QT_INSTALL_IMPORTS]/Qt/multimedia
+
+qmldir.files += $$QT_BUILD_TREE/imports/Qt/multimedia/qmldir
+qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/multimedia
+
+INSTALLS += target qmldir
+
diff --git a/src/plugins/qmlmodules/qmlmodules.pro b/src/plugins/qdeclarativemodules/qdeclarativemodules.pro
index b1dc0ef..0a6f444 100644
--- a/src/plugins/qmlmodules/qmlmodules.pro
+++ b/src/plugins/qdeclarativemodules/qdeclarativemodules.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
+SUBDIRS += widgets
+
contains(QT_CONFIG, multimedia): SUBDIRS += multimedia
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp b/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp
new file mode 100644
index 0000000..fc15ad2
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative 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 "graphicslayouts_p.h"
+
+#include <QtGui/qgraphicswidget.h>
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+LinearLayoutAttached::LinearLayoutAttached(QObject *parent)
+: QObject(parent), _stretch(1), _alignment(Qt::AlignCenter)
+{
+}
+
+void LinearLayoutAttached::setStretchFactor(int f)
+{
+ if (_stretch == f)
+ return;
+
+ _stretch = f;
+ emit stretchChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _stretch);
+}
+
+void LinearLayoutAttached::setAlignment(Qt::Alignment a)
+{
+ if (_alignment == a)
+ return;
+
+ _alignment = a;
+ emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
+}
+
+QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+Q_UNUSED(which);
+Q_UNUSED(constraint);
+return QSizeF();
+}
+
+
+QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent)
+: QObject(parent)
+{
+}
+
+QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject()
+{
+}
+
+void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item)
+{
+insertItem(index, item);
+
+//connect attached properties
+if (LinearLayoutAttached *obj = attachedProperties.value(item)) {
+ setStretchFactor(item, obj->stretchFactor());
+ setAlignment(item, obj->alignment());
+ QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
+ this, SLOT(updateStretch(QGraphicsLayoutItem*,int)));
+ QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
+ this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment)));
+ //### need to disconnect when widget is removed?
+}
+}
+
+//### is there a better way to do this?
+void QGraphicsLinearLayoutObject::clearChildren()
+{
+for (int i = 0; i < count(); ++i)
+ removeAt(i);
+}
+
+void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch)
+{
+QGraphicsLinearLayout::setStretchFactor(item, stretch);
+}
+
+void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
+{
+QGraphicsLinearLayout::setAlignment(item, alignment);
+}
+
+QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> QGraphicsLinearLayoutObject::attachedProperties;
+LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj)
+{
+// ### This is not allowed - you must attach to any object
+if (!qobject_cast<QGraphicsLayoutItem*>(obj))
+ return 0;
+LinearLayoutAttached *rv = new LinearLayoutAttached(obj);
+attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
+return rv;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+// QGraphicsGridLayout-related classes
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+GridLayoutAttached::GridLayoutAttached(QObject *parent)
+: QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1)
+{
+}
+
+void GridLayoutAttached::setRow(int r)
+{
+ if (_row == r)
+ return;
+
+ _row = r;
+ //emit rowChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _row);
+}
+
+void GridLayoutAttached::setColumn(int c)
+{
+ if (_column == c)
+ return;
+
+ _column = c;
+ //emit columnChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _column);
+}
+
+void GridLayoutAttached::setRowSpan(int rs)
+{
+ if (_rowspan == rs)
+ return;
+
+ _rowspan = rs;
+ //emit rowSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _rowSpan);
+}
+
+void GridLayoutAttached::setColumnSpan(int cs)
+{
+ if (_colspan == cs)
+ return;
+
+ _colspan = cs;
+ //emit columnSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _columnSpan);
+}
+
+void GridLayoutAttached::setAlignment(Qt::Alignment a)
+{
+ if (_alignment == a)
+ return;
+
+ _alignment = a;
+ //emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
+}
+
+QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent)
+: QObject(parent)
+{
+}
+
+QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject()
+{
+}
+
+void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
+{
+//use attached properties
+if (QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
+ int row = static_cast<GridLayoutAttached *>(obj)->row();
+ int column = static_cast<GridLayoutAttached *>(obj)->column();
+ int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
+ int columnSpan = static_cast<GridLayoutAttached *>(obj)->columnSpan();
+ if (row == -1 || column == -1) {
+ qWarning() << "Must set row and column for an item in a grid layout";
+ return;
+ }
+ addItem(wid, row, column, rowSpan, columnSpan);
+}
+}
+
+void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
+{
+//use attached properties
+if (GridLayoutAttached *obj = attachedProperties.value(item)) {
+ int row = obj->row();
+ int column = obj->column();
+ int rowSpan = obj->rowSpan();
+ int columnSpan = obj->columnSpan();
+ Qt::Alignment alignment = obj->alignment();
+ if (row == -1 || column == -1) {
+ qWarning() << "Must set row and column for an item in a grid layout";
+ return;
+ }
+ addItem(item, row, column, rowSpan, columnSpan);
+ if (alignment != -1)
+ setAlignment(item,alignment);
+}
+}
+
+//### is there a better way to do this?
+void QGraphicsGridLayoutObject::clearChildren()
+{
+for (int i = 0; i < count(); ++i)
+ removeAt(i);
+}
+
+qreal QGraphicsGridLayoutObject::spacing() const
+{
+if (verticalSpacing() == horizontalSpacing())
+ return verticalSpacing();
+return -1; //###
+}
+
+QHash<QGraphicsLayoutItem*, GridLayoutAttached*> QGraphicsGridLayoutObject::attachedProperties;
+GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj)
+{
+// ### This is not allowed - you must attach to any object
+if (!qobject_cast<QGraphicsLayoutItem*>(obj))
+ return 0;
+GridLayoutAttached *rv = new GridLayoutAttached(obj);
+attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
+return rv;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h b/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h
new file mode 100644
index 0000000..f9b9ae8
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative 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 GRAPHICSLAYOUTS_H
+#define GRAPHICSLAYOUTS_H
+
+#include "graphicswidgets_p.h"
+
+#include <QtGui/QGraphicsLinearLayout>
+#include <QtGui/QGraphicsGridLayout>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QGraphicsLinearLayoutStretchItemObject : public QObject, public QGraphicsLayoutItem
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsLayoutItem)
+public:
+ QGraphicsLinearLayoutStretchItemObject(QObject *parent = 0);
+
+ virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const;
+};
+
+class LinearLayoutAttached;
+class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
+
+ Q_PROPERTY(QDeclarativeListProperty<QGraphicsLayoutItem> children READ children)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
+ Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
+ Q_CLASSINFO("DefaultProperty", "children")
+public:
+ QGraphicsLinearLayoutObject(QObject * = 0);
+ ~QGraphicsLinearLayoutObject();
+
+ QDeclarativeListProperty<QGraphicsLayoutItem> children() { return QDeclarativeListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
+
+ static LinearLayoutAttached *qmlAttachedProperties(QObject *);
+
+private Q_SLOTS:
+ void updateStretch(QGraphicsLayoutItem*,int);
+ void updateAlignment(QGraphicsLayoutItem*,Qt::Alignment);
+
+private:
+ friend class LinearLayoutAttached;
+ void clearChildren();
+ void insertLayoutItem(int, QGraphicsLayoutItem *);
+ static QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> attachedProperties;
+
+ static void children_append(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
+ static_cast<QGraphicsLinearLayoutObject*>(prop->object)->insertLayoutItem(-1, item);
+ }
+
+ static void children_clear(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
+ static_cast<QGraphicsLinearLayoutObject*>(prop->object)->clearChildren();
+ }
+
+ static int children_count(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
+ return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->count();
+ }
+
+ static QGraphicsLayoutItem *children_at(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, int index) {
+ return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->itemAt(index);
+ }
+};
+
+class GridLayoutAttached;
+class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
+
+ Q_PROPERTY(QDeclarativeListProperty<QGraphicsLayoutItem> children READ children)
+ Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
+ Q_PROPERTY(qreal verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
+ Q_PROPERTY(qreal horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
+ Q_CLASSINFO("DefaultProperty", "children")
+public:
+ QGraphicsGridLayoutObject(QObject * = 0);
+ ~QGraphicsGridLayoutObject();
+
+ QDeclarativeListProperty<QGraphicsLayoutItem> children() { return QDeclarativeListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
+
+ qreal spacing() const;
+
+ static GridLayoutAttached *qmlAttachedProperties(QObject *);
+
+private:
+ friend class GraphicsLayoutAttached;
+ void addWidget(QGraphicsWidget *);
+ void clearChildren();
+ void addLayoutItem(QGraphicsLayoutItem *);
+ static QHash<QGraphicsLayoutItem*, GridLayoutAttached*> attachedProperties;
+
+ static void children_append(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
+ static_cast<QGraphicsGridLayoutObject*>(prop->object)->addLayoutItem(item);
+ }
+
+ static void children_clear(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
+ static_cast<QGraphicsGridLayoutObject*>(prop->object)->clearChildren();
+ }
+
+ static int children_count(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
+ return static_cast<QGraphicsGridLayoutObject*>(prop->object)->count();
+ }
+
+ static QGraphicsLayoutItem *children_at(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, int index) {
+ return static_cast<QGraphicsGridLayoutObject*>(prop->object)->itemAt(index);
+ }
+};
+
+class LinearLayoutAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
+public:
+ LinearLayoutAttached(QObject *parent);
+
+ int stretchFactor() const { return _stretch; }
+ void setStretchFactor(int f);
+ Qt::Alignment alignment() const { return _alignment; }
+ void setAlignment(Qt::Alignment a);
+
+Q_SIGNALS:
+ void stretchChanged(QGraphicsLayoutItem*,int);
+ void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment);
+
+private:
+ int _stretch;
+ Qt::Alignment _alignment;
+};
+
+class GridLayoutAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int row READ row WRITE setRow)
+ Q_PROPERTY(int column READ column WRITE setColumn)
+ Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan)
+ Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
+public:
+ GridLayoutAttached(QObject *parent);
+
+ int row() const { return _row; }
+ void setRow(int r);
+
+ int column() const { return _column; }
+ void setColumn(int c);
+
+ int rowSpan() const { return _rowspan; }
+ void setRowSpan(int rs);
+
+ int columnSpan() const { return _colspan; }
+ void setColumnSpan(int cs);
+
+ Qt::Alignment alignment() const { return _alignment; }
+ void setAlignment(Qt::Alignment a);
+
+private:
+ int _row;
+ int _column;
+ int _rowspan;
+ int _colspan;
+ Qt::Alignment _alignment;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_INTERFACE(QGraphicsLayoutItem)
+QML_DECLARE_INTERFACE(QGraphicsLayout)
+QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject)
+QML_DECLARE_TYPE(QGraphicsLinearLayoutObject)
+QML_DECLARE_TYPEINFO(QGraphicsLinearLayoutObject, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QGraphicsGridLayoutObject)
+QML_DECLARE_TYPEINFO(QGraphicsGridLayoutObject, QML_HAS_ATTACHED_PROPERTIES)
+
+QT_END_HEADER
+
+#endif // GRAPHICSLAYOUTS_H
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp b/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp
new file mode 100644
index 0000000..062e516
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative 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$
+**
+****************************************************************************/
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h b/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h
new file mode 100644
index 0000000..2c2b707
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative 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 GRAPHICSWIDGETS_H
+#define GRAPHICSWIDGETS_H
+
+#include <qdeclarative.h>
+
+#include <QtGui/QGraphicsScene>
+#include <QtGui/QGraphicsView>
+#include <QtGui/QGraphicsWidget>
+#include <QtGui/QGraphicsItem>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QGraphicsView)
+QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene)
+QML_DECLARE_TYPE(QGraphicsWidget)
+QML_DECLARE_TYPE(QGraphicsObject)
+QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem)
+
+QT_END_HEADER
+
+#endif // GRAPHICSWIDGETS_H
diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.cpp b/src/plugins/qdeclarativemodules/widgets/widgets.cpp
new file mode 100644
index 0000000..ec21cc4
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/widgets/widgets.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins 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 <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+
+#include "graphicslayouts_p.h"
+#include "graphicswidgets_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QGraphicsViewDeclarativeUI : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene)
+ Q_CLASSINFO("DefaultProperty", "scene")
+public:
+ QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {}
+
+ QGraphicsScene *scene() const { return static_cast<QGraphicsView *>(parent())->scene(); }
+ void setScene(QGraphicsScene *scene)
+ {
+ static_cast<QGraphicsView *>(parent())->setScene(scene);
+ }
+};
+
+class QGraphicsSceneDeclarativeUI : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children)
+ Q_CLASSINFO("DefaultProperty", "children")
+public:
+ QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {}
+
+ QDeclarativeListProperty<QObject> children() { return QDeclarativeListProperty<QObject>(this->parent(), 0, children_append); }
+
+private:
+ static void children_append(QDeclarativeListProperty<QObject> *prop, QObject *o) {
+ if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o))
+ static_cast<QGraphicsScene *>(prop->object)->addItem(go);
+ }
+};
+
+class QGraphicsWidgetDeclarativeUI : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QDeclarativeListProperty<QGraphicsItem> children READ children)
+ Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout)
+ Q_CLASSINFO("DefaultProperty", "children")
+public:
+ QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {}
+
+ QDeclarativeListProperty<QGraphicsItem> children() { return QDeclarativeListProperty<QGraphicsItem>(this, 0, children_append); }
+
+ QGraphicsLayout *layout() const { return static_cast<QGraphicsWidget *>(parent())->layout(); }
+ void setLayout(QGraphicsLayout *lo)
+ {
+ static_cast<QGraphicsWidget *>(parent())->setLayout(lo);
+ }
+
+private:
+ void setItemParent(QGraphicsItem *wid)
+ {
+ wid->setParentItem(static_cast<QGraphicsWidget *>(parent()));
+ }
+
+ static void children_append(QDeclarativeListProperty<QGraphicsItem> *prop, QGraphicsItem *i) {
+ static_cast<QGraphicsWidgetDeclarativeUI*>(prop->object)->setItemParent(i);
+ }
+};
+
+class QWidgetsQmlModule : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets"));
+
+ QML_REGISTER_INTERFACE(QGraphicsLayoutItem);
+ QML_REGISTER_INTERFACE(QGraphicsLayout);
+ qmlRegisterType<QGraphicsLinearLayoutStretchItemObject>(uri,4,6,"QGraphicsLinearLayoutStretchItem");
+ qmlRegisterType<QGraphicsLinearLayoutObject>(uri,4,6,"QGraphicsLinearLayout");
+ qmlRegisterType<QGraphicsGridLayoutObject>(uri,4,6,"QGraphicsGridLayout");
+ qmlRegisterExtendedType<QGraphicsView, QGraphicsViewDeclarativeUI>(uri,4,6,"QGraphicsView");
+ qmlRegisterExtendedType<QGraphicsScene,QGraphicsSceneDeclarativeUI>(uri,4,6,"QGraphicsScene");
+ qmlRegisterExtendedType<QGraphicsWidget,QGraphicsWidgetDeclarativeUI>(uri,4,6,"QGraphicsWidget");
+ QML_REGISTER_INTERFACE(QGraphicsItem);
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "widgets.moc"
+
+Q_EXPORT_PLUGIN2(qtwidgetsqmlmodule, QT_PREPEND_NAMESPACE(QWidgetsQmlModule));
+
diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.pro b/src/plugins/qdeclarativemodules/widgets/widgets.pro
new file mode 100644
index 0000000..3ec38da
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/widgets/widgets.pro
@@ -0,0 +1,20 @@
+TARGET = widgets
+include(../../qpluginbase.pri)
+
+QT += declarative
+
+SOURCES += \
+ graphicslayouts.cpp \
+ widgets.cpp
+
+HEADERS += \
+ graphicswidgets_p.h \
+ graphicslayouts_p.h
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/widgets
+target.path = $$[QT_INSTALL_IMPORTS]/Qt/widgets
+
+qmldir.files += $$QT_BUILD_TREE/imports/Qt/widgets/qmldir
+qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/widgets
+
+INSTALLS += target qmldir
diff --git a/src/plugins/qmlmodules/multimedia/multimedia.pro b/src/plugins/qmlmodules/multimedia/multimedia.pro
deleted file mode 100644
index f04cc14..0000000
--- a/src/plugins/qmlmodules/multimedia/multimedia.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TARGET = multimedia
-include(../../qpluginbase.pri)
-
-QT += multimedia declarative
-
-SOURCES += multimedia.cpp
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmlmodules
-target.path = $$[QT_INSTALL_PLUGINS]/plugins/qmlmodules
-INSTALLS += target
-