summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/snippets
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-16 01:29:47 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-16 01:29:47 (GMT)
commit140a96d0b860b045c18d53c1ac96e77b3893d31c (patch)
tree3dc9885e18c8d37955e073d415c02ac1656e0f30 /doc/src/declarative/snippets
parent07f724cd5abd0548fb32ed3469bde113daf028c4 (diff)
parentfc399f2cd81772fed179d59a6f53abe69a81083a (diff)
downloadQt-140a96d0b860b045c18d53c1ac96e77b3893d31c.zip
Qt-140a96d0b860b045c18d53c1ac96e77b3893d31c.tar.gz
Qt-140a96d0b860b045c18d53c1ac96e77b3893d31c.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (32 commits) Correctly support translation in QDeclarativePixmapCache Improve warning for non-Item delegates. Correctly support translation in QDeclarativeCompiler Small calculator fix. Improve declarative calculator example. Update examples autotest to use the runtime directly Support valuetypes as method return values Compile without Qt3 support. Doc Simplify dynamic resource loading to avoid cluttering Text API. Add Component.onDestruction attached property Use qmlInfo for image loading errors, not qWarning(). Visual test updates. Rename section so that it's not linked to by references to "JavaScript" Doc improvements Comments Remove unused parameter Correctly resolve, and load, IMG tags in Text element. Rename "sql" test so autotester doesn't get confused. Should work now, don't skip. ...
Diffstat (limited to 'doc/src/declarative/snippets')
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h58
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/graphicswidgets.pro13
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/main.qml32
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/qmldir1
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h57
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/shapesplugin.cpp61
6 files changed, 222 insertions, 0 deletions
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h b/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h
new file mode 100644
index 0000000..028718f
--- /dev/null
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** 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 documentation 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$
+**
+****************************************************************************/
+//![0]
+#include <QtDeclarative/qdeclarative.h>
+#include <QGraphicsWidget>
+#include <QPainter>
+
+class BlueCircle : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+ {
+ painter->setPen(QColor(Qt::blue));
+ painter->drawEllipse(0, 0, size().width(), size().height());
+ }
+};
+
+QML_DECLARE_TYPE(BlueCircle)
+//![0]
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/graphicswidgets.pro b/doc/src/declarative/snippets/integrating/graphicswidgets/graphicswidgets.pro
new file mode 100644
index 0000000..21c8a37
--- /dev/null
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/graphicswidgets.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += qt plugin
+QT += declarative
+
+HEADERS += redsquare.h \
+ bluecircle.h
+
+SOURCES += shapesplugin.cpp
+
+DESTDIR = lib
+OBJECTS_DIR = tmp
+MOC_DIR = tmp
+
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/main.qml b/doc/src/declarative/snippets/integrating/graphicswidgets/main.qml
new file mode 100644
index 0000000..ffcf79d
--- /dev/null
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/main.qml
@@ -0,0 +1,32 @@
+import Qt 4.7
+import Qt.widgets 4.7
+
+Rectangle {
+ width: 200
+ height: 200
+
+ RedSquare {
+ id: square
+ width: 80
+ height: 80
+ }
+
+ BlueCircle {
+ anchors.left: square.right
+ width: 80
+ height: 80
+ }
+
+ QGraphicsWidget {
+ anchors.top: square.bottom
+ size.width: 80
+ size.height: 80
+ layout: QGraphicsLinearLayout {
+ LayoutItem {
+ preferredSize: "100x100"
+ Rectangle { color: "yellow"; anchors.fill: parent }
+ }
+ }
+ }
+}
+
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/qmldir b/doc/src/declarative/snippets/integrating/graphicswidgets/qmldir
new file mode 100644
index 0000000..f94dad2
--- /dev/null
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/qmldir
@@ -0,0 +1 @@
+plugin graphicswidgets lib
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h b/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h
new file mode 100644
index 0000000..76e7d11
--- /dev/null
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** 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 documentation 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$
+**
+****************************************************************************/
+//![0]
+#include <QtDeclarative/qdeclarative.h>
+#include <QGraphicsWidget>
+#include <QPainter>
+
+class RedSquare : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+ {
+ painter->fillRect(0, 0, size().width(), size().height(), QColor(Qt::red));
+ }
+};
+
+QML_DECLARE_TYPE(RedSquare)
+//![0]
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/shapesplugin.cpp b/doc/src/declarative/snippets/integrating/graphicswidgets/shapesplugin.cpp
new file mode 100644
index 0000000..4c18ef3
--- /dev/null
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/shapesplugin.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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 documentation 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$
+**
+****************************************************************************/
+//![0]
+#include "redsquare.h"
+#include "bluecircle.h"
+
+#include <QtDeclarative/QDeclarativeExtensionPlugin>
+#include <QtDeclarative/qdeclarative.h>
+
+class ShapesPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ void registerTypes(const char *uri) {
+ qmlRegisterType<RedSquare>(uri, 1, 0, "RedSquare");
+ qmlRegisterType<BlueCircle>(uri, 1, 0, "BlueCircle");
+ }
+};
+
+#include "shapesplugin.moc"
+
+Q_EXPORT_PLUGIN2(shapesplugin, ShapesPlugin);
+//![0]