summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2010-02-26 15:19:54 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2010-02-26 15:19:54 (GMT)
commited1d9f24d035857438e5bb9ccb423310bc30310b (patch)
treeef949d57470b11331a6a2b667f2cdb5467c285cd /src/plugins
parentab9a87eb2a5af0b74834e247f44fb4fad0dfb8cb (diff)
parent27e403d9c6185c606980bb7881e39a2c88138a13 (diff)
downloadQt-ed1d9f24d035857438e5bb9ccb423310bc30310b.zip
Qt-ed1d9f24d035857438e5bb9ccb423310bc30310b.tar.gz
Qt-ed1d9f24d035857438e5bb9ccb423310bc30310b.tar.bz2
Merge remote branch 'origin/master' into berlin-master
Conflicts: configure.exe
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp12
-rw-r--r--src/plugins/bearer/symbian/symbian.pro1
-rw-r--r--src/plugins/mediaservices/gstreamer/gstreamer.pro12
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp2
-rw-r--r--src/plugins/mediaservices/mediaservices.pro13
-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
16 files changed, 787 insertions, 55 deletions
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index f654038..e6c871d 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -60,6 +60,7 @@
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_arp.h>
+#include <unistd.h>
#endif
QT_BEGIN_NAMESPACE
@@ -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/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/mediaservices/gstreamer/gstreamer.pro b/src/plugins/mediaservices/gstreamer/gstreamer.pro
index db0ee4e..22e3c16 100644
--- a/src/plugins/mediaservices/gstreamer/gstreamer.pro
+++ b/src/plugins/mediaservices/gstreamer/gstreamer.pro
@@ -8,16 +8,8 @@ unix:contains(QT_CONFIG, alsa) {
LIBS += -lasound
}
-LIBS += -lXv
-
-CONFIG += link_pkgconfig
-
-PKGCONFIG += \
- gstreamer-0.10 \
- gstreamer-base-0.10 \
- gstreamer-interfaces-0.10 \
- gstreamer-audio-0.10 \
- gstreamer-video-0.10
+QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER
+LIBS += -lXv $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 -lgstaudio-0.10
# Input
HEADERS += \
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
index 0a689d9..13a2454 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
@@ -48,7 +48,7 @@ static int wuchi = qRegisterMetaType<QGstreamerMessage>();
/*!
- \class QGstreamerMessage
+ \class gstreamer::QGstreamerMessage
\internal
*/
diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro
index 0cef605..d84b276 100644
--- a/src/plugins/mediaservices/mediaservices.pro
+++ b/src/plugins/mediaservices/mediaservices.pro
@@ -5,16 +5,7 @@ contains(QT_CONFIG, mediaservice) {
mac: SUBDIRS += qt7
- unix:!mac:!symbian {
- TMP_GST_LIBS = \
- gstreamer-0.10 >= 0.10.19 \
- gstreamer-base-0.10 >= 0.10.19 \
- gstreamer-interfaces-0.10 >= 0.10.19 \
- gstreamer-audio-0.10 >= 0.10.19 \
- gstreamer-video-0.10 >= 0.10.19
-
- system(pkg-config --exists \'$${TMP_GST_LIBS}\' --print-errors): {
- SUBDIRS += gstreamer
- }
+ unix:!mac:!symbian:contains(QT_CONFIG, xvideo):contains(QT_CONFIG, gstreamer) {
+ SUBDIRS += gstreamer
}
}
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
-