summaryrefslogtreecommitdiffstats
path: root/examples/draganddrop
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2012-08-17 13:23:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-20 12:20:55 +0200
commit806dda08d685bc5f9ed71dfe8b61f21848d48066 (patch)
treea63533a1c4a335ae17adc105abb0ae4e62e2f26e /examples/draganddrop
parent9f942014e31842b512c3198de035d041c59f54a9 (diff)
Moving .qdoc files under examples/widgets/doc
Updated those .qdoc files to refer to the new relative examples emplacement. Images and snippets to be moved later. Also grouped all widgets related examples under widgets. Change-Id: Ib29696e2d8948524537f53e8dda88f9ee26a597f Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
Diffstat (limited to 'examples/draganddrop')
-rw-r--r--examples/draganddrop/README9
-rw-r--r--examples/draganddrop/delayedencoding/delayedencoding.desktop11
-rw-r--r--examples/draganddrop/draganddrop.pro13
-rw-r--r--examples/draganddrop/draggableicons/draggableicons.desktop11
-rw-r--r--examples/draganddrop/draggableicons/draggableicons.pro12
-rw-r--r--examples/draganddrop/draggableicons/draggableicons.qrc7
-rw-r--r--examples/draganddrop/draggableicons/dragwidget.cpp168
-rw-r--r--examples/draganddrop/draggableicons/dragwidget.h65
-rw-r--r--examples/draganddrop/draggableicons/images/boat.pngbin2772 -> 0 bytes
-rw-r--r--examples/draganddrop/draggableicons/images/car.pngbin2963 -> 0 bytes
-rw-r--r--examples/draganddrop/draggableicons/images/house.pngbin3292 -> 0 bytes
-rw-r--r--examples/draganddrop/draggableicons/main.cpp61
-rw-r--r--examples/draganddrop/draggabletext/draggabletext.desktop11
-rw-r--r--examples/draganddrop/draggabletext/draggabletext.pro15
-rw-r--r--examples/draganddrop/draggabletext/draggabletext.qrc5
-rw-r--r--examples/draganddrop/draggabletext/draglabel.cpp51
-rw-r--r--examples/draganddrop/draggabletext/draglabel.h58
-rw-r--r--examples/draganddrop/draggabletext/dragwidget.cpp165
-rw-r--r--examples/draganddrop/draggabletext/dragwidget.h62
-rw-r--r--examples/draganddrop/draggabletext/main.cpp52
-rw-r--r--examples/draganddrop/draggabletext/words.txt41
-rw-r--r--examples/draganddrop/dropsite/droparea.cpp126
-rw-r--r--examples/draganddrop/dropsite/droparea.h77
-rw-r--r--examples/draganddrop/dropsite/dropsite.desktop11
-rw-r--r--examples/draganddrop/dropsite/dropsite.pro14
-rw-r--r--examples/draganddrop/dropsite/dropsitewindow.cpp143
-rw-r--r--examples/draganddrop/dropsite/dropsitewindow.h77
-rw-r--r--examples/draganddrop/dropsite/main.cpp53
-rw-r--r--examples/draganddrop/fridgemagnets/draglabel.cpp89
-rw-r--r--examples/draganddrop/fridgemagnets/draglabel.h64
-rw-r--r--examples/draganddrop/fridgemagnets/dragwidget.cpp212
-rw-r--r--examples/draganddrop/fridgemagnets/dragwidget.h65
-rw-r--r--examples/draganddrop/fridgemagnets/fridgemagnets.desktop11
-rw-r--r--examples/draganddrop/fridgemagnets/fridgemagnets.pro15
-rw-r--r--examples/draganddrop/fridgemagnets/fridgemagnets.qrc5
-rw-r--r--examples/draganddrop/fridgemagnets/main.cpp61
-rw-r--r--examples/draganddrop/fridgemagnets/words.txt48
-rw-r--r--examples/draganddrop/puzzle/example.jpgbin42654 -> 0 bytes
-rw-r--r--examples/draganddrop/puzzle/main.cpp54
-rw-r--r--examples/draganddrop/puzzle/mainwindow.cpp152
-rw-r--r--examples/draganddrop/puzzle/mainwindow.h76
-rw-r--r--examples/draganddrop/puzzle/pieceslist.cpp121
-rw-r--r--examples/draganddrop/puzzle/pieceslist.h63
-rw-r--r--examples/draganddrop/puzzle/puzzle.desktop11
-rw-r--r--examples/draganddrop/puzzle/puzzle.pro23
-rw-r--r--examples/draganddrop/puzzle/puzzle.qrc5
-rw-r--r--examples/draganddrop/puzzle/puzzlewidget.cpp214
-rw-r--r--examples/draganddrop/puzzle/puzzlewidget.h89
48 files changed, 0 insertions, 2696 deletions
diff --git a/examples/draganddrop/README b/examples/draganddrop/README
deleted file mode 100644
index 90dc55bf2f..0000000000
--- a/examples/draganddrop/README
+++ /dev/null
@@ -1,9 +0,0 @@
-Qt supports native drag and drop on all platforms via an extensible
-MIME-based system that enables applications to send data to each other in the
-most appropriate formats.
-
-Drag and drop can also be implemented for internal use by applications.
-
-
-Documentation for these examples can be found via the Examples
-link in the main Qt documentation.
diff --git a/examples/draganddrop/delayedencoding/delayedencoding.desktop b/examples/draganddrop/delayedencoding/delayedencoding.desktop
deleted file mode 100644
index 629c497b6b..0000000000
--- a/examples/draganddrop/delayedencoding/delayedencoding.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Delayed Encoding
-Exec=/opt/usr/bin/delayedencoding
-Icon=delayedencoding
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/draganddrop/draganddrop.pro b/examples/draganddrop/draganddrop.pro
deleted file mode 100644
index a209ae31e4..0000000000
--- a/examples/draganddrop/draganddrop.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = draggableicons \
- draggabletext \
- dropsite \
- fridgemagnets \
- puzzle
-
-wince*: SUBDIRS -= dropsite
-# install
-sources.files = README *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop
-INSTALLS += sources
-QT += widgets
diff --git a/examples/draganddrop/draggableicons/draggableicons.desktop b/examples/draganddrop/draggableicons/draggableicons.desktop
deleted file mode 100644
index d14f758ce6..0000000000
--- a/examples/draganddrop/draggableicons/draggableicons.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Draggable Icons
-Exec=/opt/usr/bin/draggableicons
-Icon=draggableicons
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/draganddrop/draggableicons/draggableicons.pro b/examples/draganddrop/draggableicons/draggableicons.pro
deleted file mode 100644
index 9f4156135f..0000000000
--- a/examples/draganddrop/draggableicons/draggableicons.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-HEADERS = dragwidget.h
-RESOURCES = draggableicons.qrc
-SOURCES = dragwidget.cpp \
- main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/draggableicons
-sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro images
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/draggableicons
-INSTALLS += target sources
-
-QT += widgets
diff --git a/examples/draganddrop/draggableicons/draggableicons.qrc b/examples/draganddrop/draggableicons/draggableicons.qrc
deleted file mode 100644
index 63f84ac066..0000000000
--- a/examples/draganddrop/draggableicons/draggableicons.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="">
- <file>images/boat.png</file>
- <file>images/car.png</file>
- <file>images/house.png</file>
-</qresource>
-</RCC>
diff --git a/examples/draganddrop/draggableicons/dragwidget.cpp b/examples/draganddrop/draggableicons/dragwidget.cpp
deleted file mode 100644
index 93a02a4647..0000000000
--- a/examples/draganddrop/draggableicons/dragwidget.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "dragwidget.h"
-
-//! [0]
-DragWidget::DragWidget(QWidget *parent)
- : QFrame(parent)
-{
- setMinimumSize(200, 200);
- setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
- setAcceptDrops(true);
-
- QLabel *boatIcon = new QLabel(this);
- boatIcon->setPixmap(QPixmap(":/images/boat.png"));
- boatIcon->move(10, 10);
- boatIcon->show();
- boatIcon->setAttribute(Qt::WA_DeleteOnClose);
-
- QLabel *carIcon = new QLabel(this);
- carIcon->setPixmap(QPixmap(":/images/car.png"));
- carIcon->move(100, 10);
- carIcon->show();
- carIcon->setAttribute(Qt::WA_DeleteOnClose);
-
- QLabel *houseIcon = new QLabel(this);
- houseIcon->setPixmap(QPixmap(":/images/house.png"));
- houseIcon->move(10, 80);
- houseIcon->show();
- houseIcon->setAttribute(Qt::WA_DeleteOnClose);
-}
-//! [0]
-
-void DragWidget::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasFormat("application/x-dnditemdata")) {
- if (event->source() == this) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- event->acceptProposedAction();
- }
- } else {
- event->ignore();
- }
-}
-
-void DragWidget::dragMoveEvent(QDragMoveEvent *event)
-{
- if (event->mimeData()->hasFormat("application/x-dnditemdata")) {
- if (event->source() == this) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- event->acceptProposedAction();
- }
- } else {
- event->ignore();
- }
-}
-
-void DragWidget::dropEvent(QDropEvent *event)
-{
- if (event->mimeData()->hasFormat("application/x-dnditemdata")) {
- QByteArray itemData = event->mimeData()->data("application/x-dnditemdata");
- QDataStream dataStream(&itemData, QIODevice::ReadOnly);
-
- QPixmap pixmap;
- QPoint offset;
- dataStream >> pixmap >> offset;
-
- QLabel *newIcon = new QLabel(this);
- newIcon->setPixmap(pixmap);
- newIcon->move(event->pos() - offset);
- newIcon->show();
- newIcon->setAttribute(Qt::WA_DeleteOnClose);
-
- if (event->source() == this) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- event->acceptProposedAction();
- }
- } else {
- event->ignore();
- }
-}
-
-//! [1]
-void DragWidget::mousePressEvent(QMouseEvent *event)
-{
- QLabel *child = static_cast<QLabel*>(childAt(event->pos()));
- if (!child)
- return;
-
- QPixmap pixmap = *child->pixmap();
-
- QByteArray itemData;
- QDataStream dataStream(&itemData, QIODevice::WriteOnly);
- dataStream << pixmap << QPoint(event->pos() - child->pos());
-//! [1]
-
-//! [2]
- QMimeData *mimeData = new QMimeData;
- mimeData->setData("application/x-dnditemdata", itemData);
-//! [2]
-
-//! [3]
- QDrag *drag = new QDrag(this);
- drag->setMimeData(mimeData);
- drag->setPixmap(pixmap);
- drag->setHotSpot(event->pos() - child->pos());
-//! [3]
-
- QPixmap tempPixmap = pixmap;
- QPainter painter;
- painter.begin(&tempPixmap);
- painter.fillRect(pixmap.rect(), QColor(127, 127, 127, 127));
- painter.end();
-
- child->setPixmap(tempPixmap);
-
- if (drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction) == Qt::MoveAction)
- child->close();
- else {
- child->show();
- child->setPixmap(pixmap);
- }
-}
diff --git a/examples/draganddrop/draggableicons/dragwidget.h b/examples/draganddrop/draggableicons/dragwidget.h
deleted file mode 100644
index b2fae51c5e..0000000000
--- a/examples/draganddrop/draggableicons/dragwidget.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRAGWIDGET_H
-#define DRAGWIDGET_H
-
-#include <QFrame>
-
-QT_BEGIN_NAMESPACE
-class QDragEnterEvent;
-class QDropEvent;
-QT_END_NAMESPACE
-
-//! [0]
-class DragWidget : public QFrame
-{
-public:
- DragWidget(QWidget *parent=0);
-
-protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dropEvent(QDropEvent *event);
- void mousePressEvent(QMouseEvent *event);
-};
-//! [0]
-
-#endif
diff --git a/examples/draganddrop/draggableicons/images/boat.png b/examples/draganddrop/draggableicons/images/boat.png
deleted file mode 100644
index 46c894f06b..0000000000
--- a/examples/draganddrop/draggableicons/images/boat.png
+++ /dev/null
Binary files differ
diff --git a/examples/draganddrop/draggableicons/images/car.png b/examples/draganddrop/draggableicons/images/car.png
deleted file mode 100644
index 3cb35e56cb..0000000000
--- a/examples/draganddrop/draggableicons/images/car.png
+++ /dev/null
Binary files differ
diff --git a/examples/draganddrop/draggableicons/images/house.png b/examples/draganddrop/draggableicons/images/house.png
deleted file mode 100644
index ee9d5b1159..0000000000
--- a/examples/draganddrop/draggableicons/images/house.png
+++ /dev/null
Binary files differ
diff --git a/examples/draganddrop/draggableicons/main.cpp b/examples/draganddrop/draggableicons/main.cpp
deleted file mode 100644
index 5a7120c9d5..0000000000
--- a/examples/draganddrop/draggableicons/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QHBoxLayout>
-#include "dragwidget.h"
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(draggableicons);
-
- QApplication app(argc, argv);
-
- QWidget mainWidget;
- QHBoxLayout *horizontalLayout = new QHBoxLayout;
- horizontalLayout->addWidget(new DragWidget);
- horizontalLayout->addWidget(new DragWidget);
-
- mainWidget.setLayout(horizontalLayout);
- mainWidget.setWindowTitle(QObject::tr("Draggable Icons"));
- mainWidget.show();
-
- return app.exec();
-}
diff --git a/examples/draganddrop/draggabletext/draggabletext.desktop b/examples/draganddrop/draggabletext/draggabletext.desktop
deleted file mode 100644
index ceda807604..0000000000
--- a/examples/draganddrop/draggabletext/draggabletext.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Draggable Text
-Exec=/opt/usr/bin/draggabletext
-Icon=draggabletext
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/draganddrop/draggabletext/draggabletext.pro b/examples/draganddrop/draggabletext/draggabletext.pro
deleted file mode 100644
index 1fd8e5ce6e..0000000000
--- a/examples/draganddrop/draggabletext/draggabletext.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-HEADERS = draglabel.h \
- dragwidget.h
-RESOURCES = draggabletext.qrc
-SOURCES = draglabel.cpp \
- dragwidget.cpp \
- main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/draggabletext
-sources.files = $$SOURCES $$HEADERS $$RESOURCES *.txt *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/draggabletext
-INSTALLS += target sources
-
-QT += widgets
-
diff --git a/examples/draganddrop/draggabletext/draggabletext.qrc b/examples/draganddrop/draggabletext/draggabletext.qrc
deleted file mode 100644
index b72217d701..0000000000
--- a/examples/draganddrop/draggabletext/draggabletext.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/dictionary">
- <file>words.txt</file>
-</qresource>
-</RCC>
diff --git a/examples/draganddrop/draggabletext/draglabel.cpp b/examples/draganddrop/draggabletext/draglabel.cpp
deleted file mode 100644
index 803e659157..0000000000
--- a/examples/draganddrop/draggabletext/draglabel.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "draglabel.h"
-
-DragLabel::DragLabel(const QString &text, QWidget *parent)
- : QLabel(text, parent)
-{
- setAutoFillBackground(true);
- setFrameShape(QFrame::Panel);
- setFrameShadow(QFrame::Raised);
-}
diff --git a/examples/draganddrop/draggabletext/draglabel.h b/examples/draganddrop/draggabletext/draglabel.h
deleted file mode 100644
index e067a37652..0000000000
--- a/examples/draganddrop/draggabletext/draglabel.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRAGLABEL_H
-#define DRAGLABEL_H
-
-#include <QLabel>
-
-QT_BEGIN_NAMESPACE
-class QDragEnterEvent;
-class QDragMoveEvent;
-class QFrame;
-QT_END_NAMESPACE
-
-class DragLabel : public QLabel
-{
-public:
- DragLabel(const QString &text, QWidget *parent);
-};
-
-#endif
diff --git a/examples/draganddrop/draggabletext/dragwidget.cpp b/examples/draganddrop/draggabletext/dragwidget.cpp
deleted file mode 100644
index 60d84ebb5b..0000000000
--- a/examples/draganddrop/draggabletext/dragwidget.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "draglabel.h"
-#include "dragwidget.h"
-
-DragWidget::DragWidget(QWidget *parent)
- : QWidget(parent)
-{
- QFile dictionaryFile(":/dictionary/words.txt");
- dictionaryFile.open(QIODevice::ReadOnly);
- QTextStream inputStream(&dictionaryFile);
-
- int x = 5;
- int y = 5;
-
- while (!inputStream.atEnd()) {
- QString word;
- inputStream >> word;
- if (!word.isEmpty()) {
- DragLabel *wordLabel = new DragLabel(word, this);
- wordLabel->move(x, y);
- wordLabel->show();
- wordLabel->setAttribute(Qt::WA_DeleteOnClose);
- x += wordLabel->width() + 2;
- if (x >= 245) {
- x = 5;
- y += wordLabel->height() + 2;
- }
- }
- }
-
- /*
- QPalette newPalette = palette();
- newPalette.setColor(QPalette::Window, Qt::white);
- setPalette(newPalette);
- */
-
- setAcceptDrops(true);
- setMinimumSize(400, qMax(200, y));
- setWindowTitle(tr("Draggable Text"));
-}
-
-void DragWidget::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasText()) {
- if (event->source() == this) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- event->acceptProposedAction();
- }
- } else {
- event->ignore();
- }
-}
-
-void DragWidget::dropEvent(QDropEvent *event)
-{
- if (event->mimeData()->hasText()) {
- const QMimeData *mime = event->mimeData();
- QStringList pieces = mime->text().split(QRegExp("\\s+"),
- QString::SkipEmptyParts);
- QPoint position = event->pos();
- QPoint hotSpot;
-
- QList<QByteArray> hotSpotPos = mime->data("application/x-hotspot").split(' ');
- if (hotSpotPos.size() == 2) {
- hotSpot.setX(hotSpotPos.first().toInt());
- hotSpot.setY(hotSpotPos.last().toInt());
- }
-
- foreach (QString piece, pieces) {
- DragLabel *newLabel = new DragLabel(piece, this);
- newLabel->move(position - hotSpot);
- newLabel->show();
- newLabel->setAttribute(Qt::WA_DeleteOnClose);
-
- position += QPoint(newLabel->width(), 0);
- }
-
- if (event->source() == this) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- event->acceptProposedAction();
- }
- } else {
- event->ignore();
- }
- foreach (QObject *child, children()) {
- if (child->inherits("QWidget")) {
- QWidget *widget = static_cast<QWidget *>(child);
- if (!widget->isVisible())
- widget->deleteLater();
- }
- }
-}
-
-void DragWidget::mousePressEvent(QMouseEvent *event)
-{
- QLabel *child = static_cast<QLabel*>(childAt(event->pos()));
- if (!child)
- return;
-
- QPoint hotSpot = event->pos() - child->pos();
-
- QMimeData *mimeData = new QMimeData;
- mimeData->setText(child->text());
- mimeData->setData("application/x-hotspot",
- QByteArray::number(hotSpot.x())
- + " " + QByteArray::number(hotSpot.y()));
-
- QPixmap pixmap(child->size());
- child->render(&pixmap);
-
- QDrag *drag = new QDrag(this);
- drag->setMimeData(mimeData);
- drag->setPixmap(pixmap);
- drag->setHotSpot(hotSpot);
-
- Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
-
- if (dropAction == Qt::MoveAction)
- child->close();
-}
diff --git a/examples/draganddrop/draggabletext/dragwidget.h b/examples/draganddrop/draggabletext/dragwidget.h
deleted file mode 100644
index deef7fe4dd..0000000000
--- a/examples/draganddrop/draggabletext/dragwidget.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRAGWIDGET_H
-#define DRAGWIDGET_H
-
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-class QDragEnterEvent;
-class QDropEvent;
-QT_END_NAMESPACE
-
-class DragWidget : public QWidget
-{
-public:
- DragWidget(QWidget *parent = 0);
-
-protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dropEvent(QDropEvent *event);
- void mousePressEvent(QMouseEvent *event);
-};
-
-#endif
diff --git a/examples/draganddrop/draggabletext/main.cpp b/examples/draganddrop/draggabletext/main.cpp
deleted file mode 100644
index 3c57afff6a..0000000000
--- a/examples/draganddrop/draggabletext/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include "dragwidget.h"
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(draggabletext);
-
- QApplication app(argc, argv);
- DragWidget window;
- window.show();
- return app.exec();
-}
diff --git a/examples/draganddrop/draggabletext/words.txt b/examples/draganddrop/draggabletext/words.txt
deleted file mode 100644
index 19b8b0325b..0000000000
--- a/examples/draganddrop/draggabletext/words.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Qt
-Quarterly
-is
-a
-paper
-based
-newsletter
-exclusively
-available
-to
-Qt
-customers
-Every
-quarter
-we
-mail
-out
-an
-issue
-that
-we
-hope
-will
-bring
-added
-insight
-and
-pleasure
-to
-your
-Qt
-programming
-with
-high
-quality
-technical
-articles
-written
-by
-Qt
-experts
diff --git a/examples/draganddrop/dropsite/droparea.cpp b/examples/draganddrop/dropsite/droparea.cpp
deleted file mode 100644
index 95bbd3000c..0000000000
--- a/examples/draganddrop/dropsite/droparea.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "droparea.h"
-
-//! [DropArea constructor]
-DropArea::DropArea(QWidget *parent)
- : QLabel(parent)
-{
- setMinimumSize(200, 200);
- setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
- setAlignment(Qt::AlignCenter);
- setAcceptDrops(true);
- setAutoFillBackground(true);
- clear();
-}
-//! [DropArea constructor]
-
-//! [dragEnterEvent() function]
-void DropArea::dragEnterEvent(QDragEnterEvent *event)
-{
- setText(tr("<drop content>"));
- setBackgroundRole(QPalette::Highlight);
-
- event->acceptProposedAction();
- emit changed(event->mimeData());
-}
-//! [dragEnterEvent() function]
-
-//! [dragMoveEvent() function]
-void DropArea::dragMoveEvent(QDragMoveEvent *event)
-{
- event->acceptProposedAction();
-}
-//! [dragMoveEvent() function]
-
-//! [dropEvent() function part1]
-void DropArea::dropEvent(QDropEvent *event)
-{
- const QMimeData *mimeData = event->mimeData();
-//! [dropEvent() function part1]
-
-//! [dropEvent() function part2]
- if (mimeData->hasImage()) {
- setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
- } else if (mimeData->hasHtml()) {
- setText(mimeData->html());
- setTextFormat(Qt::RichText);
- } else if (mimeData->hasText()) {
- setText(mimeData->text());
- setTextFormat(Qt::PlainText);
- } else if (mimeData->hasUrls()) {
- QList<QUrl> urlList = mimeData->urls();
- QString text;
- for (int i = 0; i < urlList.size() && i < 32; ++i) {
- QString url = urlList.at(i).path();
- text += url + QString("\n");
- }
- setText(text);
- } else {
- setText(tr("Cannot display data"));
- }
-//! [dropEvent() function part2]
-
-//! [dropEvent() function part3]
- setBackgroundRole(QPalette::Dark);
- event->acceptProposedAction();
-}
-//! [dropEvent() function part3]
-
-//! [dragLeaveEvent() function]
-void DropArea::dragLeaveEvent(QDragLeaveEvent *event)
-{
- clear();
- event->accept();
-}
-//! [dragLeaveEvent() function]
-
-//! [clear() function]
-void DropArea::clear()
-{
- setText(tr("<drop content>"));
- setBackgroundRole(QPalette::Dark);
-
- emit changed();
-}
-//! [clear() function]
diff --git a/examples/draganddrop/dropsite/droparea.h b/examples/draganddrop/dropsite/droparea.h
deleted file mode 100644
index e1586990df..0000000000
--- a/examples/draganddrop/dropsite/droparea.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DROPAREA_H
-#define DROPAREA_H
-
-#include <QLabel>
-
-QT_BEGIN_NAMESPACE
-class QMimeData;
-QT_END_NAMESPACE
-
-//! [DropArea header part1]
-class DropArea : public QLabel
-{
- Q_OBJECT
-
-public:
- DropArea(QWidget *parent = 0);
-
-public slots:
- void clear();
-
-signals:
- void changed(const QMimeData *mimeData = 0);
-//! [DropArea header part1]
-
-//! [DropArea header part2]
-protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dragLeaveEvent(QDragLeaveEvent *event);
- void dropEvent(QDropEvent *event);
-
-private:
- QLabel *label;
-};
-//! [DropArea header part2]
-
-#endif
diff --git a/examples/draganddrop/dropsite/dropsite.desktop b/examples/draganddrop/dropsite/dropsite.desktop
deleted file mode 100644
index 70a192f2b1..0000000000
--- a/examples/draganddrop/dropsite/dropsite.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Drop Site
-Exec=/opt/usr/bin/dropsite
-Icon=dropsite
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/draganddrop/dropsite/dropsite.pro b/examples/draganddrop/dropsite/dropsite.pro
deleted file mode 100644
index 8198b19e79..0000000000
--- a/examples/draganddrop/dropsite/dropsite.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-HEADERS = droparea.h \
- dropsitewindow.h
-SOURCES = droparea.cpp \
- dropsitewindow.cpp \
- main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/dropsite
-sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro images
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/dropsite
-INSTALLS += target sources
-
-QT += widgets
-simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/draganddrop/dropsite/dropsitewindow.cpp b/examples/draganddrop/dropsite/dropsitewindow.cpp
deleted file mode 100644
index f7fc5aa1ab..0000000000
--- a/examples/draganddrop/dropsite/dropsitewindow.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "droparea.h"
-#include "dropsitewindow.h"
-
-//! [constructor part1]
-DropSiteWindow::DropSiteWindow()
-{
- abstractLabel = new QLabel(tr("This example accepts drags from other "
- "applications and displays the MIME types "
- "provided by the drag object."));
- abstractLabel->setWordWrap(true);
- abstractLabel->adjustSize();
-//! [constructor part1]
-
-//! [constructor part2]
- dropArea = new DropArea;
- connect(dropArea, SIGNAL(changed(const QMimeData*)),
- this, SLOT(updateFormatsTable(const QMimeData*)));
-//! [constructor part2]
-
-//! [constructor part3]
- QStringList labels;
- labels << tr("Format") << tr("Content");
-
- formatsTable = new QTableWidget;
- formatsTable->setColumnCount(2);
- formatsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
- formatsTable->setHorizontalHeaderLabels(labels);
- formatsTable->horizontalHeader()->setStretchLastSection(true);
-//! [constructor part3]
-
-//! [constructor part4]
- clearButton = new QPushButton(tr("Clear"));
- quitButton = new QPushButton(tr("Quit"));
-
- buttonBox = new QDialogButtonBox;
- buttonBox->addButton(clearButton, QDialogButtonBox::ActionRole);
- buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);
-
- connect(quitButton, SIGNAL(pressed()), this, SLOT(close()));
- connect(clearButton, SIGNAL(pressed()), dropArea, SLOT(clear()));
-//! [constructor part4]
-
-//! [constructor part5]
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(abstractLabel);
- mainLayout->addWidget(dropArea);
- mainLayout->addWidget(formatsTable);
- mainLayout->addWidget(buttonBox);
- setLayout(mainLayout);
-
- setWindowTitle(tr("Drop Site"));
- setMinimumSize(350, 500);
-}
-//! [constructor part5]
-
-//! [updateFormatsTable() part1]
-void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData)
-{
- formatsTable->setRowCount(0);
- if (!mimeData)
- return;
-//! [updateFormatsTable() part1]
-
-//! [updateFormatsTable() part2]
- foreach (QString format, mimeData->formats()) {
- QTableWidgetItem *formatItem = new QTableWidgetItem(format);
- formatItem->setFlags(Qt::ItemIsEnabled);
- formatItem->setTextAlignment(Qt::AlignTop | Qt::AlignLeft);
-//! [updateFormatsTable() part2]
-
-//! [updateFormatsTable() part3]
- QString text;
- if (format == "text/plain") {
- text = mimeData->text().simplified();
- } else if (format == "text/html") {
- text = mimeData->html().simplified();
- } else if (format == "text/uri-list") {
- QList<QUrl> urlList = mimeData->urls();
- for (int i = 0; i < urlList.size() && i < 32; ++i)
- text.append(urlList[i].toString() + " ");
- } else {
- QByteArray data = mimeData->data(format);
- for (int i = 0; i < data.size() && i < 32; ++i) {
- QString hex = QString("%1").arg(uchar(data[i]), 2, 16,
- QChar('0'))
- .toUpper();
- text.append(hex + " ");
- }
- }
-//! [updateFormatsTable() part3]
-
-//! [updateFormatsTable() part4]
- int row = formatsTable->rowCount();
- formatsTable->insertRow(row);
- formatsTable->setItem(row, 0, new QTableWidgetItem(format));
- formatsTable->setItem(row, 1, new QTableWidgetItem(text));
- }
-
- formatsTable->resizeColumnToContents(0);
-}
-//! [updateFormatsTable() part4]
diff --git a/examples/draganddrop/dropsite/dropsitewindow.h b/examples/draganddrop/dropsite/dropsitewindow.h
deleted file mode 100644
index 049e9593f4..0000000000
--- a/examples/draganddrop/dropsite/dropsitewindow.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DROPSITEWINDOW_H
-#define DROPSITEWINDOW_H
-
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-class QDialogButtonBox;
-class QLabel;
-class QMimeData;
-class QPushButton;
-class QTableWidget;
-QT_END_NAMESPACE
-class DropArea;
-
-//! [DropSiteWindow header]
-class DropSiteWindow : public QWidget
-{
- Q_OBJECT
-
-public:
- DropSiteWindow();
-
-public slots:
- void updateFormatsTable(const QMimeData *mimeData);
-
-private:
- DropArea *dropArea;
- QLabel *abstractLabel;
- QTableWidget *formatsTable;
-
- QPushButton *clearButton;
- QPushButton *quitButton;
- QDialogButtonBox *buttonBox;
-};
-//! [DropSiteWindow header]
-
-#endif
diff --git a/examples/draganddrop/dropsite/main.cpp b/examples/draganddrop/dropsite/main.cpp
deleted file mode 100644
index f6220fa42e..0000000000
--- a/examples/draganddrop/dropsite/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "dropsitewindow.h"
-
-//! [main() function]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- DropSiteWindow window;
- window.show();
- return app.exec();
-}
-//! [main() function]
diff --git a/examples/draganddrop/fridgemagnets/draglabel.cpp b/examples/draganddrop/fridgemagnets/draglabel.cpp
deleted file mode 100644
index a4e52ed635..0000000000
--- a/examples/draganddrop/fridgemagnets/draglabel.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "draglabel.h"
-
-//! [0]
-DragLabel::DragLabel(const QString &text, QWidget *parent)
- : QLabel(parent)
-{
- QFontMetrics metric(font());
- QSize size = metric.size(Qt::TextSingleLine, text);
-
- QImage image(size.width() + 12, size.height() + 12,
- QImage::Format_ARGB32_Premultiplied);
- image.fill(qRgba(0, 0, 0, 0));
-
- QFont font;
- font.setStyleStrategy(QFont::ForceOutline);
-//! [0]
-
-//! [1]
- QLinearGradient gradient(0, 0, 0, image.height()-1);
- gradient.setColorAt(0.0, Qt::white);
- gradient.setColorAt(0.2, QColor(200, 200, 255));
- gradient.setColorAt(0.8, QColor(200, 200, 255));
- gradient.setColorAt(1.0, QColor(127, 127, 200));
-
- QPainter painter;
- painter.begin(&image);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.setBrush(gradient);
- painter.drawRoundedRect(QRectF(0.5, 0.5, image.width()-1, image.height()-1),
- 25, 25, Qt::RelativeSize);
-
- painter.setFont(font);
- painter.setBrush(Qt::black);
- painter.drawText(QRect(QPoint(6, 6), size), Qt::AlignCenter, text);
- painter.end();
-//! [1]
-
-//! [2]
- setPixmap(QPixmap::fromImage(image));
- m_labelText = text;
-}
-//! [2]
-
-QString DragLabel::labelText() const
-{
- return m_labelText;
-}
diff --git a/examples/draganddrop/fridgemagnets/draglabel.h b/examples/draganddrop/fridgemagnets/draglabel.h
deleted file mode 100644
index ecbd02d896..0000000000
--- a/examples/draganddrop/fridgemagnets/draglabel.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRAGLABEL_H
-#define DRAGLABEL_H
-
-#include <QLabel>
-
-QT_BEGIN_NAMESPACE
-class QDragEnterEvent;
-class QDragMoveEvent;
-class QFrame;
-QT_END_NAMESPACE
-
-//! [0]
-class DragLabel : public QLabel
-{
-public:
- DragLabel(const QString &text, QWidget *parent);
- QString labelText() const;
-
-private:
- QString m_labelText;
-};
-//! [0]
-
-#endif
diff --git a/examples/draganddrop/fridgemagnets/dragwidget.cpp b/examples/draganddrop/fridgemagnets/dragwidget.cpp
deleted file mode 100644
index 434fcecb22..0000000000
--- a/examples/draganddrop/fridgemagnets/dragwidget.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "draglabel.h"
-#include "dragwidget.h"
-
-//! [0]
-DragWidget::DragWidget(QWidget *parent)
- : QWidget(parent)
-{
- QFile dictionaryFile(":/dictionary/words.txt");
- dictionaryFile.open(QFile::ReadOnly);
- QTextStream inputStream(&dictionaryFile);
-//! [0]
-
-//! [1]
- int x = 5;
- int y = 5;
-
- while (!inputStream.atEnd()) {
- QString word;
- inputStream >> word;
- if (!word.isEmpty()) {
- DragLabel *wordLabel = new DragLabel(word, this);
- wordLabel->move(x, y);
- wordLabel->show();
- wordLabel->setAttribute(Qt::WA_DeleteOnClose);
- x += wordLabel->width() + 2;
- if (x >= 245) {
- x = 5;
- y += wordLabel->height() + 2;
- }
- }
- }
-//! [1]
-
-//! [2]
- //Fridge magnets is used for demoing Qt on S60 and themed backgrounds look better than white
- QPalette newPalette = palette();
- newPalette.setColor(QPalette::Window, Qt::white);
- setPalette(newPalette);
-
- setMinimumSize(400, qMax(200, y));
- setWindowTitle(tr("Fridge Magnets"));
-//! [2] //! [3]
- setAcceptDrops(true);
-}
-//! [3]
-
-//! [4]
-void DragWidget::dragEnterEvent(QDragEnterEvent *event)
-{
-//! [4] //! [5]
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
- if (children().contains(event->source())) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- event->acceptProposedAction();
-//! [5] //! [6]
- }
-//! [6] //! [7]
- } else if (event->mimeData()->hasText()) {
- event->acceptProposedAction();
- } else {
- event->ignore();
- }
-}
-//! [7]
-
-//! [8]
-void DragWidget::dragMoveEvent(QDragMoveEvent *event)
-{
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
- if (children().contains(event->source())) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- event->acceptProposedAction();
- }
- } else if (event->mimeData()->hasText()) {
- event->acceptProposedAction();
- } else {
- event->ignore();
- }
-}
-//! [8]
-
-//! [9]
-void DragWidget::dropEvent(QDropEvent *event)
-{
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
- const QMimeData *mime = event->mimeData();
-//! [9] //! [10]
- QByteArray itemData = mime->data("application/x-fridgemagnet");
- QDataStream dataStream(&itemData, QIODevice::ReadOnly);
-
- QString text;
- QPoint offset;
- dataStream >> text >> offset;
-//! [10]
-//! [11]
- DragLabel *newLabel = new DragLabel(text, this);
- newLabel->move(event->pos() - offset);
- newLabel->show();
- newLabel->setAttribute(Qt::WA_DeleteOnClose);
-
- if (event->source() == this) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- event->acceptProposedAction();
- }
-//! [11] //! [12]
- } else if (event->mimeData()->hasText()) {
- QStringList pieces = event->mimeData()->text().split(QRegExp("\\s+"),
- QString::SkipEmptyParts);
- QPoint position = event->pos();
-
- foreach (QString piece, pieces) {
- DragLabel *newLabel = new DragLabel(piece, this);
- newLabel->move(position);
- newLabel->show();
- newLabel->setAttribute(Qt::WA_DeleteOnClose);
-
- position += QPoint(newLabel->width(), 0);
- }
-
- event->acceptProposedAction();
- } else {
- event->ignore();
- }
-}
-//! [12]
-
-//! [13]
-void DragWidget::mousePressEvent(QMouseEvent *event)
-{
-//! [13]
-//! [14]
- DragLabel *child = static_cast<DragLabel*>(childAt(event->pos()));
- if (!child)
- return;
-
- QPoint hotSpot = event->pos() - child->pos();
-
- QByteArray itemData;
- QDataStream dataStream(&itemData, QIODevice::WriteOnly);
- dataStream << child->labelText() << QPoint(hotSpot);
-//! [14]
-
-//! [15]
- QMimeData *mimeData = new QMimeData;
- mimeData->setData("application/x-fridgemagnet", itemData);
- mimeData->setText(child->labelText());
-//! [15]
-
-//! [16]
- QDrag *drag = new QDrag(this);
- drag->setMimeData(mimeData);
- drag->setPixmap(*child->pixmap());
- drag->setHotSpot(hotSpot);
-
- child->hide();
-//! [16]
-
-//! [17]
- if (drag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction) == Qt::MoveAction)
- child->close();
- else
- child->show();
-}
-//! [17]
diff --git a/examples/draganddrop/fridgemagnets/dragwidget.h b/examples/draganddrop/fridgemagnets/dragwidget.h
deleted file mode 100644
index a3e3ced25e..0000000000
--- a/examples/draganddrop/fridgemagnets/dragwidget.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRAGWIDGET_H
-#define DRAGWIDGET_H
-
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-class QDragEnterEvent;
-class QDropEvent;
-QT_END_NAMESPACE
-
-//! [0]
-class DragWidget : public QWidget
-{
-public:
- DragWidget(QWidget *parent = 0);
-
-protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dropEvent(QDropEvent *event);
- void mousePressEvent(QMouseEvent *event);
-};
-//! [0]
-
-#endif
diff --git a/examples/draganddrop/fridgemagnets/fridgemagnets.desktop b/examples/draganddrop/fridgemagnets/fridgemagnets.desktop
deleted file mode 100644
index a240590c6b..0000000000
--- a/examples/draganddrop/fridgemagnets/fridgemagnets.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Fridge Magnets
-Exec=/opt/usr/bin/fridgemagnets
-Icon=fridgemagnets
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/draganddrop/fridgemagnets/fridgemagnets.pro b/examples/draganddrop/fridgemagnets/fridgemagnets.pro
deleted file mode 100644
index 2bbfdf0b3a..0000000000
--- a/examples/draganddrop/fridgemagnets/fridgemagnets.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-HEADERS = draglabel.h \
- dragwidget.h
-RESOURCES = fridgemagnets.qrc
-SOURCES = draglabel.cpp \
- dragwidget.cpp \
- main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/fridgemagnets
-sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.txt
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/fridgemagnets
-INSTALLS += target sources
-
-QT += widgets
-
diff --git a/examples/draganddrop/fridgemagnets/fridgemagnets.qrc b/examples/draganddrop/fridgemagnets/fridgemagnets.qrc
deleted file mode 100644
index b72217d701..0000000000
--- a/examples/draganddrop/fridgemagnets/fridgemagnets.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/dictionary">
- <file>words.txt</file>
-</qresource>
-</RCC>
diff --git a/examples/draganddrop/fridgemagnets/main.cpp b/examples/draganddrop/fridgemagnets/main.cpp
deleted file mode 100644
index 692a5e394a..0000000000
--- a/examples/draganddrop/fridgemagnets/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include "dragwidget.h"
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(fridgemagnets);
-
- QApplication app(argc, argv);
-#ifdef QT_KEYPAD_NAVIGATION
- QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
-#endif
- DragWidget window;
-
- bool smallScreen = QApplication::arguments().contains("-small-screen");
- if (smallScreen)
- window.showFullScreen();
- else
- window.show();
-
- return app.exec();
-}
diff --git a/examples/draganddrop/fridgemagnets/words.txt b/examples/draganddrop/fridgemagnets/words.txt
deleted file mode 100644
index a7e1632b09..0000000000
--- a/examples/draganddrop/fridgemagnets/words.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-Colorless
-green
-ideas
-sleep
-furiously
-A
-colorless
-green
-idea
-is
-a
-new
-untried
-idea
-that
-is
-without
-vividness
-dull
-and
-unexciting
-To
-sleep
-furiously
-may
-seem
-a
-puzzling
-turn
-of
-phrase
-but
-the
-mind
-in
-sleep
-often
-indeed
-moves
-furiously
-with
-ideas
-and
-images
-flickering
-in
-and
-out
diff --git a/examples/draganddrop/puzzle/example.jpg b/examples/draganddrop/puzzle/example.jpg
deleted file mode 100644
index e09fb70757..0000000000
--- a/examples/draganddrop/puzzle/example.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/draganddrop/puzzle/main.cpp b/examples/draganddrop/puzzle/main.cpp
deleted file mode 100644
index 31b7142819..0000000000
--- a/examples/draganddrop/puzzle/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(puzzle);
-
- QApplication app(argc, argv);
- MainWindow window;
- window.openImage(":/images/example.jpg");
- window.show();
- return app.exec();
-}
diff --git a/examples/draganddrop/puzzle/mainwindow.cpp b/examples/draganddrop/puzzle/mainwindow.cpp
deleted file mode 100644
index 0540aaef9f..0000000000
--- a/examples/draganddrop/puzzle/mainwindow.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <stdlib.h>
-
-#include "mainwindow.h"
-#include "pieceslist.h"
-#include "puzzlewidget.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- setupMenus();
- setupWidgets();
-
- setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
- setWindowTitle(tr("Puzzle"));
-}
-
-void MainWindow::openImage(const QString &path)
-{
- QString fileName = path;
-
- if (fileName.isNull())
- fileName = QFileDialog::getOpenFileName(this,
- tr("Open Image"), "", "Image Files (*.png *.jpg *.bmp)");
-
- if (!fileName.isEmpty()) {
- QPixmap newImage;
- if (!newImage.load(fileName)) {
- QMessageBox::warning(this, tr("Open Image"),
- tr("The image file could not be loaded."),
- QMessageBox::Cancel);
- return;
- }
- puzzleImage = newImage;
- setupPuzzle();
- }
-}
-
-void MainWindow::setCompleted()
-{
- QMessageBox::information(this, tr("Puzzle Completed"),
- tr("Congratulations! You have completed the puzzle!\n"
- "Click OK to start again."),
- QMessageBox::Ok);
-
- setupPuzzle();
-}
-
-void MainWindow::setupPuzzle()
-{
- int size = qMin(puzzleImage.width(), puzzleImage.height());
- puzzleImage = puzzleImage.copy((puzzleImage.width() - size)/2,
- (puzzleImage.height() - size)/2, size, size).scaled(puzzleWidget->width(),
- puzzleWidget->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-
- piecesList->clear();
-
- for (int y = 0; y < 5; ++y) {
- for (int x = 0; x < 5; ++x) {
- int pieceSize = puzzleWidget->pieceSize();
- QPixmap pieceImage = puzzleImage.copy(x * pieceSize, y * pieceSize, pieceSize, pieceSize);
- piecesList->addPiece(pieceImage, QPoint(x, y));
- }
- }
-
- qsrand(QCursor::pos().x() ^ QCursor::pos().y());
-
- for (int i = 0; i < piecesList->count(); ++i) {
- if (int(2.0*qrand()/(RAND_MAX+1.0)) == 1) {
- QListWidgetItem *item = piecesList->takeItem(i);
- piecesList->insertItem(0, item);
- }
- }
-
- puzzleWidget->clear();
-}
-
-void MainWindow::setupMenus()
-{
- QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
-
- QAction *openAction = fileMenu->addAction(tr("&Open..."));
- openAction->setShortcuts(QKeySequence::Open);
-
- QAction *exitAction = fileMenu->addAction(tr("E&xit"));
- exitAction->setShortcuts(QKeySequence::Quit);
-
- QMenu *gameMenu = menuBar()->addMenu(tr("&Game"));
-
- QAction *restartAction = gameMenu->addAction(tr("&Restart"));
-
- connect(openAction, SIGNAL(triggered()), this, SLOT(openImage()));
- connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(restartAction, SIGNAL(triggered()), this, SLOT(setupPuzzle()));
-}
-
-void MainWindow::setupWidgets()
-{
- QFrame *frame = new QFrame;
- QHBoxLayout *frameLayout = new QHBoxLayout(frame);
- puzzleWidget = new PuzzleWidget(400);
-
- piecesList = new PiecesList(puzzleWidget->pieceSize(), this);
-
-
- connect(puzzleWidget, SIGNAL(puzzleCompleted()),
- this, SLOT(setCompleted()), Qt::QueuedConnection);
-
- frameLayout->addWidget(piecesList);
- frameLayout->addWidget(puzzleWidget);
- setCentralWidget(frame);
-}
diff --git a/examples/draganddrop/puzzle/mainwindow.h b/examples/draganddrop/puzzle/mainwindow.h
deleted file mode 100644
index c7ce2c8ef3..0000000000
--- a/examples/draganddrop/puzzle/mainwindow.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QPixmap>
-#include <QMainWindow>
-
-class PiecesList;
-class PuzzleWidget;
-QT_BEGIN_NAMESPACE
-class QListWidgetItem;
-QT_END_NAMESPACE
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWindow(QWidget *parent = 0);
-
-public slots:
- void openImage(const QString &path = QString());
- void setupPuzzle();
-
-private slots:
- void setCompleted();
-
-private:
- void setupMenus();
- void setupWidgets();
-
- QPixmap puzzleImage;
- PiecesList *piecesList;
- PuzzleWidget *puzzleWidget;
-};
-
-#endif
diff --git a/examples/draganddrop/puzzle/pieceslist.cpp b/examples/draganddrop/puzzle/pieceslist.cpp
deleted file mode 100644
index 8e0892aae6..0000000000
--- a/examples/draganddrop/puzzle/pieceslist.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "pieceslist.h"
-
-PiecesList::PiecesList(int pieceSize, QWidget *parent)
- : QListWidget(parent), m_PieceSize(pieceSize)
-{
- setDragEnabled(true);
- setViewMode(QListView::IconMode);
- setIconSize(QSize(m_PieceSize, m_PieceSize));
- setSpacing(10);
- setAcceptDrops(true);
- setDropIndicatorShown(true);
-}
-
-void PiecesList::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece"))
- event->accept();
- else
- event->ignore();
-}
-
-void PiecesList::dragMoveEvent(QDragMoveEvent *event)
-{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece")) {
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else
- event->ignore();
-}
-
-void PiecesList::dropEvent(QDropEvent *event)
-{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece")) {
- QByteArray pieceData = event->mimeData()->data("image/x-puzzle-piece");
- QDataStream dataStream(&pieceData, QIODevice::ReadOnly);
- QPixmap pixmap;
- QPoint location;
- dataStream >> pixmap >> location;
-
- addPiece(pixmap, location);
-
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else
- event->ignore();
-}
-
-void PiecesList::addPiece(QPixmap pixmap, QPoint location)
-{
- QListWidgetItem *pieceItem = new QListWidgetItem(this);
- pieceItem->setIcon(QIcon(pixmap));
- pieceItem->setData(Qt::UserRole, QVariant(pixmap));
- pieceItem->setData(Qt::UserRole+1, location);
- pieceItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable
- | Qt::ItemIsDragEnabled);
-}
-
-void PiecesList::startDrag(Qt::DropActions /*supportedActions*/)
-{
- QListWidgetItem *item = currentItem();
-
- QByteArray itemData;
- QDataStream dataStream(&itemData, QIODevice::WriteOnly);
- QPixmap pixmap = qvariant_cast<QPixmap>(item->data(Qt::UserRole));
- QPoint location = item->data(Qt::UserRole+1).toPoint();
-
- dataStream << pixmap << location;
-
- QMimeData *mimeData = new QMimeData;
- mimeData->setData("image/x-puzzle-piece", itemData);
-
- QDrag *drag = new QDrag(this);
- drag->setMimeData(mimeData);
- drag->setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2));
- drag->setPixmap(pixmap);
-
- if (drag->exec(Qt::MoveAction) == Qt::MoveAction)
- delete takeItem(row(item));
-}
diff --git a/examples/draganddrop/puzzle/pieceslist.h b/examples/draganddrop/puzzle/pieceslist.h
deleted file mode 100644
index 3c6b042b4e..0000000000
--- a/examples/draganddrop/puzzle/pieceslist.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PIECESLIST_H
-#define PIECESLIST_H
-
-#include <QListWidget>
-
-class PiecesList : public QListWidget
-{
- Q_OBJECT
-
-public:
- PiecesList(int pieceSize, QWidget *parent = 0);
- void addPiece(QPixmap pixmap, QPoint location);
-
-protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dropEvent(QDropEvent *event);
- void startDrag(Qt::DropActions supportedActions);
-
- int m_PieceSize;
-};
-
-#endif
diff --git a/examples/draganddrop/puzzle/puzzle.desktop b/examples/draganddrop/puzzle/puzzle.desktop
deleted file mode 100644
index f6765e1e01..0000000000
--- a/examples/draganddrop/puzzle/puzzle.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Drag and Drop Puzzle
-Exec=/opt/usr/bin/puzzle
-Icon=puzzle
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/draganddrop/puzzle/puzzle.pro b/examples/draganddrop/puzzle/puzzle.pro
deleted file mode 100644
index 7c69a41a39..0000000000
--- a/examples/draganddrop/puzzle/puzzle.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-HEADERS = mainwindow.h \
- pieceslist.h \
- puzzlewidget.h
-RESOURCES = puzzle.qrc
-SOURCES = main.cpp \
- mainwindow.cpp \
- pieceslist.cpp \
- puzzlewidget.cpp
-
-QMAKE_PROJECT_NAME = dndpuzzle
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/puzzle
-sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.jpg
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/puzzle
-INSTALLS += target sources
-
-wince*: {
- addFile.files = example.jpg
- addFile.path = .
- DEPLOYMENT += addFile
-}
-QT += widgets
diff --git a/examples/draganddrop/puzzle/puzzle.qrc b/examples/draganddrop/puzzle/puzzle.qrc
deleted file mode 100644
index 4076cec026..0000000000
--- a/examples/draganddrop/puzzle/puzzle.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/images">
- <file>example.jpg</file>
-</qresource>
-</RCC>
diff --git a/examples/draganddrop/puzzle/puzzlewidget.cpp b/examples/draganddrop/puzzle/puzzlewidget.cpp
deleted file mode 100644
index 2e39f84e9e..0000000000
--- a/examples/draganddrop/puzzle/puzzlewidget.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "puzzlewidget.h"
-
-PuzzleWidget::PuzzleWidget(int imageSize, QWidget *parent)
- : QWidget(parent), m_ImageSize(imageSize)
-{
- setAcceptDrops(true);
- setMinimumSize(m_ImageSize, m_ImageSize);
- setMaximumSize(m_ImageSize, m_ImageSize);
-}
-
-void PuzzleWidget::clear()
-{
- pieceLocations.clear();
- piecePixmaps.clear();
- pieceRects.clear();
- highlightedRect = QRect();
- inPlace = 0;
- update();
-}
-
-void PuzzleWidget::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece"))
- event->accept();
- else
- event->ignore();
-}
-
-void PuzzleWidget::dragLeaveEvent(QDragLeaveEvent *event)
-{
- QRect updateRect = highlightedRect;
- highlightedRect = QRect();
- update(updateRect);
- event->accept();
-}
-
-void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event)
-{
- QRect updateRect = highlightedRect.united(targetSquare(event->pos()));
-
- if (event->mimeData()->hasFormat("image/x-puzzle-piece")
- && findPiece(targetSquare(event->pos())) == -1) {
-
- highlightedRect = targetSquare(event->pos());
- event->setDropAction(Qt::MoveAction);
- event->accept();
- } else {
- highlightedRect = QRect();
- event->ignore();
- }
-
- update(updateRect);
-}
-
-void PuzzleWidget::dropEvent(QDropEvent *event)
-{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece")
- && findPiece(targetSquare(event->pos())) == -1) {
-
- QByteArray pieceData = event->mimeData()->data("image/x-puzzle-piece");
- QDataStream dataStream(&pieceData, QIODevice::ReadOnly);
- QRect square = targetSquare(event->pos());
- QPixmap pixmap;
- QPoint location;
- dataStream >> pixmap >> location;
-
- pieceLocations.append(location);
- piecePixmaps.append(pixmap);
- pieceRects.append(square);
-
- highlightedRect = QRect();
- update(square);
-
- event->setDropAction(Qt::MoveAction);
- event->accept();
-
- if (location == QPoint(square.x()/pieceSize(), square.y()/pieceSize())) {
- inPlace++;
- if (inPlace == 25)
- emit puzzleCompleted();
- }
- } else {
- highlightedRect = QRect();
- event->ignore();
- }
-}
-
-int PuzzleWidget::findPiece(const QRect &pieceRect) const
-{
- for (int i = 0; i < pieceRects.size(); ++i) {
- if (pieceRect == pieceRects[i]) {
- return i;
- }
- }
- return -1;
-}
-
-void PuzzleWidget::mousePressEvent(QMouseEvent *event)
-{
- QRect square = targetSquare(event->pos());
- int found = findPiece(square);
-
- if (found == -1)
- return;
-
- QPoint location = pieceLocations[found];
- QPixmap pixmap = piecePixmaps[found];
- pieceLocations.removeAt(found);
- piecePixmaps.removeAt(found);
- pieceRects.removeAt(found);
-
- if (location == QPoint(square.x()/pieceSize(), square.y()/pieceSize()))
- inPlace--;
-
- update(square);
-
- QByteArray itemData;
- QDataStream dataStream(&itemData, QIODevice::WriteOnly);
-
- dataStream << pixmap << location;
-
- QMimeData *mimeData = new QMimeData;
- mimeData->setData("image/x-puzzle-piece", itemData);
-
- QDrag *drag = new QDrag(this);
- drag->setMimeData(mimeData);
- drag->setHotSpot(event->pos() - square.topLeft());
- drag->setPixmap(pixmap);
-
- if (!(drag->exec(Qt::MoveAction) == Qt::MoveAction)) {
- pieceLocations.insert(found, location);
- piecePixmaps.insert(found, pixmap);
- pieceRects.insert(found, square);
- update(targetSquare(event->pos()));
-
- if (location == QPoint(square.x()/pieceSize(), square.y()/pieceSize()))
- inPlace++;
- }
-}
-
-void PuzzleWidget::paintEvent(QPaintEvent *event)
-{
- QPainter painter;
- painter.begin(this);
- painter.fillRect(event->rect(), Qt::white);
-
- if (highlightedRect.isValid()) {
- painter.setBrush(QColor("#ffcccc"));
- painter.setPen(Qt::NoPen);
- painter.drawRect(highlightedRect.adjusted(0, 0, -1, -1));
- }
-
- for (int i = 0; i < pieceRects.size(); ++i) {
- painter.drawPixmap(pieceRects[i], piecePixmaps[i]);
- }
- painter.end();
-}
-
-const QRect PuzzleWidget::targetSquare(const QPoint &position) const
-{
- return QRect(position.x()/pieceSize() * pieceSize(), position.y()/pieceSize() * pieceSize(), pieceSize(), pieceSize());
-}
-
-int PuzzleWidget::pieceSize() const
-{
- return m_ImageSize / 5;
-}
-
-int PuzzleWidget::imageSize() const
-{
- return m_ImageSize;
-}
diff --git a/examples/draganddrop/puzzle/puzzlewidget.h b/examples/draganddrop/puzzle/puzzlewidget.h
deleted file mode 100644
index 1c0fc77a5f..0000000000
--- a/examples/draganddrop/puzzle/puzzlewidget.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PUZZLEWIDGET_H
-#define PUZZLEWIDGET_H
-
-#include <QList>
-#include <QPoint>
-#include <QPixmap>
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-class QDragEnterEvent;
-class QDropEvent;
-class QMouseEvent;
-QT_END_NAMESPACE
-
-class PuzzleWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- PuzzleWidget(int imageSize, QWidget *parent = 0);
- void clear();
-
- int pieceSize() const;
- int imageSize() const;
-
-signals:
- void puzzleCompleted();
-
-protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dragLeaveEvent(QDragLeaveEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dropEvent(QDropEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void paintEvent(QPaintEvent *event);
-
-private:
- int findPiece(const QRect &pieceRect) const;
- const QRect targetSquare(const QPoint &position) const;
-
- QList<QPixmap> piecePixmaps;
- QList<QRect> pieceRects;
- QList<QPoint> pieceLocations;
- QRect highlightedRect;
- int inPlace;
- int m_ImageSize;
-};
-
-#endif