summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/snippets/qtbinding
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-04-28 03:56:45 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-04-28 03:56:45 (GMT)
commitbfe1ed3d92cc68e9ceeaa38803b77ed17cf93263 (patch)
tree636870c6a9b132590c1d083afec6720074b83d37 /doc/src/declarative/snippets/qtbinding
parent7a89d94c208347635fa0ad5c4da9bca4a9398f5c (diff)
downloadQt-bfe1ed3d92cc68e9ceeaa38803b77ed17cf93263.zip
Qt-bfe1ed3d92cc68e9ceeaa38803b77ed17cf93263.tar.gz
Qt-bfe1ed3d92cc68e9ceeaa38803b77ed17cf93263.tar.bz2
Move snippets to correct location
Diffstat (limited to 'doc/src/declarative/snippets/qtbinding')
-rw-r--r--doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro2
-rw-r--r--doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp79
-rw-r--r--doc/src/declarative/snippets/qtbinding/contextproperties/main.qml15
-rw-r--r--doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h80
-rw-r--r--doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro3
-rw-r--r--doc/src/declarative/snippets/qtbinding/custompalette/main.cpp62
-rw-r--r--doc/src/declarative/snippets/qtbinding/custompalette/main.qml22
-rw-r--r--doc/src/declarative/snippets/qtbinding/resources/example.qrc10
-rw-r--r--doc/src/declarative/snippets/qtbinding/resources/images/background.png0
-rw-r--r--doc/src/declarative/snippets/qtbinding/resources/main.cpp58
-rw-r--r--doc/src/declarative/snippets/qtbinding/resources/main.qml7
-rw-r--r--doc/src/declarative/snippets/qtbinding/resources/resources.pro4
-rw-r--r--doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp63
-rw-r--r--doc/src/declarative/snippets/qtbinding/stopwatch/main.qml18
-rw-r--r--doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp63
-rw-r--r--doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h62
-rw-r--r--doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro3
17 files changed, 0 insertions, 551 deletions
diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro b/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro
deleted file mode 100644
index 68eeaf2..0000000
--- a/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-QT += declarative
-SOURCES += main.cpp
diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp b/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp
deleted file mode 100644
index 4073a6c..0000000
--- a/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-
-//![0]
-#include <QApplication>
-#include <QDeclarativeView>
-#include <QDeclarativeContext>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QDeclarativeView view;
- QDeclarativeContext *context = view.rootContext();
- context->setContextProperty("backgroundColor",
- QColor(Qt::yellow));
-
- view.setSource(QUrl::fromLocalFile("main.qml"));
- view.show();
-
- return app.exec();
-}
-//![0]
-
-static void alternative()
-{
- // Alternatively, if we don't actually want to display main.qml:
-//![1]
- QDeclarativeEngine engine;
- QDeclarativeContext *windowContext = new QDeclarativeContext(engine.rootContext());
- windowContext->setContextProperty("backgroundColor", QColor(Qt::yellow));
-
- QDeclarativeComponent component(&engine, "main.qml");
- QObject *window = component.create(windowContext);
-//![1]
-}
-
-
diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml b/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml
deleted file mode 100644
index 1053f73..0000000
--- a/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-//![0]
-import Qt 4.7
-
-Rectangle {
- width: 300
- height: 300
-
- color: backgroundColor
-
- Text {
- anchors.centerIn: parent
- text: "Hello Yellow World!"
- }
-}
-//![0]
diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h
deleted file mode 100644
index d0d253a..0000000
--- a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QObject>
-#include <QColor>
-
-//![0]
-class CustomPalette : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY backgroundChanged)
- Q_PROPERTY(QColor text READ text WRITE setText NOTIFY textChanged)
-
-public:
- CustomPalette() : m_background(Qt::white), m_text(Qt::black) {}
-
- QColor background() const { return m_background; }
- void setBackground(const QColor &c) {
- if (c != m_background) {
- m_background = c;
- emit backgroundChanged();
- }
- }
-
- QColor text() const { return m_text; }
- void setText(const QColor &c) {
- if (c != m_text) {
- m_text = c;
- emit textChanged();
- }
- }
-
-signals:
- void textChanged();
- void backgroundChanged();
-
-private:
- QColor m_background;
- QColor m_text;
-};
-
-//![0]
diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro
deleted file mode 100644
index e6af0d0..0000000
--- a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-QT += declarative
-HEADERS += custompalette.h
-SOURCES += main.cpp
diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp b/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp
deleted file mode 100644
index dc651f6..0000000
--- a/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QDeclarativeView>
-#include <QDeclarativeContext>
-
-#include "custompalette.h"
-
-//![0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QDeclarativeView view;
- view.rootContext()->setContextProperty("palette", new CustomPalette);
-
- view.setSource(QUrl::fromLocalFile("main.qml"));
- view.show();
-
- return app.exec();
-}
-//![0]
-
diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/main.qml b/doc/src/declarative/snippets/qtbinding/custompalette/main.qml
deleted file mode 100644
index f1a3b4f..0000000
--- a/doc/src/declarative/snippets/qtbinding/custompalette/main.qml
+++ /dev/null
@@ -1,22 +0,0 @@
-//![0]
-import Qt 4.7
-
-Rectangle {
- width: 240
- height: 320
- color: palette.background
-
- Text {
- anchors.centerIn: parent
- color: palette.text
- text: "Click me to change color!"
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- palette.text = "blue";
- }
- }
-}
-//![0]
diff --git a/doc/src/declarative/snippets/qtbinding/resources/example.qrc b/doc/src/declarative/snippets/qtbinding/resources/example.qrc
deleted file mode 100644
index 5e49415..0000000
--- a/doc/src/declarative/snippets/qtbinding/resources/example.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
-
-<qresource prefix="/">
- <file>main.qml</file>
- <file>images/background.png</file>
-</qresource>
-
-</RCC>
-
diff --git a/doc/src/declarative/snippets/qtbinding/resources/images/background.png b/doc/src/declarative/snippets/qtbinding/resources/images/background.png
deleted file mode 100644
index e69de29..0000000
--- a/doc/src/declarative/snippets/qtbinding/resources/images/background.png
+++ /dev/null
diff --git a/doc/src/declarative/snippets/qtbinding/resources/main.cpp b/doc/src/declarative/snippets/qtbinding/resources/main.cpp
deleted file mode 100644
index 5459b9e..0000000
--- a/doc/src/declarative/snippets/qtbinding/resources/main.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QDeclarativeView>
-#include <QDeclarativeContext>
-
-//![0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QDeclarativeView view;
- view.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
-//![0]
-
diff --git a/doc/src/declarative/snippets/qtbinding/resources/main.qml b/doc/src/declarative/snippets/qtbinding/resources/main.qml
deleted file mode 100644
index dfe923f..0000000
--- a/doc/src/declarative/snippets/qtbinding/resources/main.qml
+++ /dev/null
@@ -1,7 +0,0 @@
-//![0]
-import Qt 4.7
-
-Image {
- source: "images/background.png"
-}
-//![0]
diff --git a/doc/src/declarative/snippets/qtbinding/resources/resources.pro b/doc/src/declarative/snippets/qtbinding/resources/resources.pro
deleted file mode 100644
index cc01ee1..0000000
--- a/doc/src/declarative/snippets/qtbinding/resources/resources.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-QT += declarative
-
-SOURCES += main.cpp
-RESOURCES += example.qrc
diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp b/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp
deleted file mode 100644
index 537a288..0000000
--- a/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "stopwatch.h"
-
-#include <QDeclarativeView>
-#include <QDeclarativeContext>
-#include <QApplication>
-
-//![0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QDeclarativeView view;
- view.rootContext()->setContextProperty("stopwatch",
- new Stopwatch);
-
- view.setSource(QUrl::fromLocalFile("main.qml"));
- view.show();
-
- return app.exec();
-}
-//![0]
-
diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml b/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml
deleted file mode 100644
index 2efa542..0000000
--- a/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml
+++ /dev/null
@@ -1,18 +0,0 @@
-//![0]
-import Qt 4.7
-
-Rectangle {
- width: 300
- height: 300
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (stopwatch.isRunning())
- stopwatch.stop()
- else
- stopwatch.start();
- }
- }
-}
-//![0]
diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp
deleted file mode 100644
index 4954a5f..0000000
--- a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "stopwatch.h"
-
-Stopwatch::Stopwatch()
- : m_running(false)
-{
-}
-
-bool Stopwatch::isRunning() const
-{
- return m_running;
-}
-
-void Stopwatch::start()
-{
- m_running = true;
-}
-
-void Stopwatch::stop()
-{
- m_running = false;
-}
-
diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h
deleted file mode 100644
index 8d17121..0000000
--- a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QObject>
-
-//![0]
-class Stopwatch : public QObject
-{
- Q_OBJECT
-public:
- Stopwatch();
-
- Q_INVOKABLE bool isRunning() const;
-
-public slots:
- void start();
- void stop();
-
-private:
- bool m_running;
-};
-
-//![0]
-
diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro
deleted file mode 100644
index d803e6a..0000000
--- a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-QT += declarative
-HEADERS += stopwatch.h
-SOURCES += main.cpp stopwatch.cpp