From ae1b9c676dc9c590008de58ce0ab51bff3ef0f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 19 Aug 2009 16:44:50 +0200 Subject: Move examples/graphicsview/blurpicker|lighting to examples/effects. --- examples/effects/blurpicker/blureffect.cpp | 69 +++++++++++ examples/effects/blurpicker/blureffect.h | 67 +++++++++++ examples/effects/blurpicker/blurpicker.cpp | 132 +++++++++++++++++++++ examples/effects/blurpicker/blurpicker.h | 74 ++++++++++++ examples/effects/blurpicker/blurpicker.pro | 9 ++ examples/effects/blurpicker/blurpicker.qrc | 14 +++ examples/effects/blurpicker/images/README.txt | 5 + .../blurpicker/images/accessories-calculator.png | Bin 0 -> 3760 bytes .../blurpicker/images/accessories-text-editor.png | Bin 0 -> 4746 bytes examples/effects/blurpicker/images/background.jpg | Bin 0 -> 16259 bytes .../effects/blurpicker/images/help-browser.png | Bin 0 -> 5392 bytes .../blurpicker/images/internet-group-chat.png | Bin 0 -> 2809 bytes .../effects/blurpicker/images/internet-mail.png | Bin 0 -> 3899 bytes .../blurpicker/images/internet-web-browser.png | Bin 0 -> 6376 bytes .../effects/blurpicker/images/office-calendar.png | Bin 0 -> 4010 bytes .../effects/blurpicker/images/system-users.png | Bin 0 -> 5353 bytes examples/effects/blurpicker/main.cpp | 55 +++++++++ examples/effects/effects.pro | 12 ++ examples/effects/lighting/lighting.cpp | 119 +++++++++++++++++++ examples/effects/lighting/lighting.h | 70 +++++++++++ examples/effects/lighting/lighting.pro | 8 ++ examples/effects/lighting/main.cpp | 55 +++++++++ examples/effects/lighting/shadoweffect.cpp | 74 ++++++++++++ examples/effects/lighting/shadoweffect.h | 65 ++++++++++ examples/examples.pro | 1 + examples/graphicsview/blurpicker/blureffect.cpp | 69 ----------- examples/graphicsview/blurpicker/blureffect.h | 67 ----------- examples/graphicsview/blurpicker/blurpicker.cpp | 132 --------------------- examples/graphicsview/blurpicker/blurpicker.h | 74 ------------ examples/graphicsview/blurpicker/blurpicker.pro | 9 -- examples/graphicsview/blurpicker/blurpicker.qrc | 14 --- examples/graphicsview/blurpicker/images/README.txt | 5 - .../blurpicker/images/accessories-calculator.png | Bin 3760 -> 0 bytes .../blurpicker/images/accessories-text-editor.png | Bin 4746 -> 0 bytes .../graphicsview/blurpicker/images/background.jpg | Bin 16259 -> 0 bytes .../blurpicker/images/help-browser.png | Bin 5392 -> 0 bytes .../blurpicker/images/internet-group-chat.png | Bin 2809 -> 0 bytes .../blurpicker/images/internet-mail.png | Bin 3899 -> 0 bytes .../blurpicker/images/internet-web-browser.png | Bin 6376 -> 0 bytes .../blurpicker/images/office-calendar.png | Bin 4010 -> 0 bytes .../blurpicker/images/system-users.png | Bin 5353 -> 0 bytes examples/graphicsview/blurpicker/main.cpp | 55 --------- examples/graphicsview/graphicsview.pro | 2 - examples/graphicsview/lighting/lighting.cpp | 119 ------------------- examples/graphicsview/lighting/lighting.h | 70 ----------- examples/graphicsview/lighting/lighting.pro | 8 -- examples/graphicsview/lighting/main.cpp | 55 --------- examples/graphicsview/lighting/shadoweffect.cpp | 74 ------------ examples/graphicsview/lighting/shadoweffect.h | 65 ---------- 49 files changed, 829 insertions(+), 818 deletions(-) create mode 100644 examples/effects/blurpicker/blureffect.cpp create mode 100644 examples/effects/blurpicker/blureffect.h create mode 100644 examples/effects/blurpicker/blurpicker.cpp create mode 100644 examples/effects/blurpicker/blurpicker.h create mode 100644 examples/effects/blurpicker/blurpicker.pro create mode 100644 examples/effects/blurpicker/blurpicker.qrc create mode 100644 examples/effects/blurpicker/images/README.txt create mode 100644 examples/effects/blurpicker/images/accessories-calculator.png create mode 100644 examples/effects/blurpicker/images/accessories-text-editor.png create mode 100644 examples/effects/blurpicker/images/background.jpg create mode 100644 examples/effects/blurpicker/images/help-browser.png create mode 100644 examples/effects/blurpicker/images/internet-group-chat.png create mode 100644 examples/effects/blurpicker/images/internet-mail.png create mode 100644 examples/effects/blurpicker/images/internet-web-browser.png create mode 100644 examples/effects/blurpicker/images/office-calendar.png create mode 100644 examples/effects/blurpicker/images/system-users.png create mode 100644 examples/effects/blurpicker/main.cpp create mode 100644 examples/effects/effects.pro create mode 100644 examples/effects/lighting/lighting.cpp create mode 100644 examples/effects/lighting/lighting.h create mode 100644 examples/effects/lighting/lighting.pro create mode 100644 examples/effects/lighting/main.cpp create mode 100644 examples/effects/lighting/shadoweffect.cpp create mode 100644 examples/effects/lighting/shadoweffect.h delete mode 100644 examples/graphicsview/blurpicker/blureffect.cpp delete mode 100644 examples/graphicsview/blurpicker/blureffect.h delete mode 100644 examples/graphicsview/blurpicker/blurpicker.cpp delete mode 100644 examples/graphicsview/blurpicker/blurpicker.h delete mode 100644 examples/graphicsview/blurpicker/blurpicker.pro delete mode 100644 examples/graphicsview/blurpicker/blurpicker.qrc delete mode 100644 examples/graphicsview/blurpicker/images/README.txt delete mode 100644 examples/graphicsview/blurpicker/images/accessories-calculator.png delete mode 100644 examples/graphicsview/blurpicker/images/accessories-text-editor.png delete mode 100644 examples/graphicsview/blurpicker/images/background.jpg delete mode 100644 examples/graphicsview/blurpicker/images/help-browser.png delete mode 100644 examples/graphicsview/blurpicker/images/internet-group-chat.png delete mode 100644 examples/graphicsview/blurpicker/images/internet-mail.png delete mode 100644 examples/graphicsview/blurpicker/images/internet-web-browser.png delete mode 100644 examples/graphicsview/blurpicker/images/office-calendar.png delete mode 100644 examples/graphicsview/blurpicker/images/system-users.png delete mode 100644 examples/graphicsview/blurpicker/main.cpp delete mode 100644 examples/graphicsview/lighting/lighting.cpp delete mode 100644 examples/graphicsview/lighting/lighting.h delete mode 100644 examples/graphicsview/lighting/lighting.pro delete mode 100644 examples/graphicsview/lighting/main.cpp delete mode 100644 examples/graphicsview/lighting/shadoweffect.cpp delete mode 100644 examples/graphicsview/lighting/shadoweffect.h diff --git a/examples/effects/blurpicker/blureffect.cpp b/examples/effects/blurpicker/blureffect.cpp new file mode 100644 index 0000000..82be44f --- /dev/null +++ b/examples/effects/blurpicker/blureffect.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "blureffect.h" + +#include + +BlurEffect::BlurEffect(QGraphicsItem *item) + : QGraphicsBlurEffect() + , m_baseLine(200), item(item) +{ +} + +void BlurEffect::adjustForItem() +{ + qreal y = m_baseLine - item->pos().y(); + qreal radius = qBound(0.0, y / 32, 16.0); + setBlurRadius(radius); +} + +QRectF BlurEffect::boundingRect() const +{ + const_cast(this)->adjustForItem(); + return QGraphicsBlurEffect::boundingRect(); +} + +void BlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +{ + adjustForItem(); + QGraphicsBlurEffect::draw(painter, source); +} diff --git a/examples/effects/blurpicker/blureffect.h b/examples/effects/blurpicker/blureffect.h new file mode 100644 index 0000000..89694b6 --- /dev/null +++ b/examples/effects/blurpicker/blureffect.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef BLUREFFECT_H +#define BLUREFFECT_H + +#include +#include + +class BlurEffect: public QGraphicsBlurEffect +{ +public: + BlurEffect(QGraphicsItem *item); + + void setBaseLine(qreal y) { m_baseLine = y; } + + QRectF boundingRect() const; + + void draw(QPainter *painter, QGraphicsEffectSource *source); + +private: + void adjustForItem(); + +private: + qreal m_baseLine; + QGraphicsItem *item; +}; + +#endif // BLUREFFECT_H diff --git a/examples/effects/blurpicker/blurpicker.cpp b/examples/effects/blurpicker/blurpicker.cpp new file mode 100644 index 0000000..9904dfa --- /dev/null +++ b/examples/effects/blurpicker/blurpicker.cpp @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "blurpicker.h" + +#include + +#include "blureffect.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0) +{ + setBackgroundBrush(QPixmap(":/images/background.jpg")); + setScene(&m_scene); + + setupScene(); + updateIconPositions(); + + connect(&m_timeLine, SIGNAL(valueChanged(qreal)), SLOT(updateIconPositions())); + m_timeLine.setDuration(400); + + setRenderHint(QPainter::Antialiasing, true); + setFrameStyle(QFrame::NoFrame); +} + +void BlurPicker::updateIconPositions() +{ + m_index = m_timeLine.currentFrame() / 1000.0; + + qreal baseline = 0; + for (int i = 0; i < m_icons.count(); ++i) { + QGraphicsItem *icon = m_icons[i]; + qreal a = ((i + m_index) * 2 * M_PI) / m_icons.count(); + qreal xs = 170 * sin(a); + qreal ys = 100 * cos(a); + QPointF pos(xs, ys); + pos = QTransform().rotate(-20).map(pos); + pos -= QPointF(40, 40); + icon->setPos(pos); + baseline = qMax(baseline, ys); + static_cast(icon->graphicsEffect())->setBaseLine(baseline); + } + + m_scene.update(); +} + +void BlurPicker::setupScene() +{ + m_scene.setSceneRect(-200, -120, 400, 240); + + QStringList names; + names << ":/images/accessories-calculator.png"; + names << ":/images/accessories-text-editor.png"; + names << ":/images/help-browser.png"; + names << ":/images/internet-group-chat.png"; + names << ":/images/internet-mail.png"; + names << ":/images/internet-web-browser.png"; + names << ":/images/office-calendar.png"; + names << ":/images/system-users.png"; + + for (int i = 0; i < names.count(); i++) { + QPixmap pixmap(names[i]); + QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap); + icon->setZValue(1); + icon->setGraphicsEffect(new BlurEffect(icon)); + m_icons << icon; + } + + QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/images/background.jpg")); + bg->setZValue(0); + bg->setPos(-200, -150); +} + +void BlurPicker::keyPressEvent(QKeyEvent *event) +{ + if (event->key() == Qt::Key_Left) { + if (m_timeLine.state() == QTimeLine::NotRunning) { + m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 - 1000); + m_timeLine.start(); + event->accept(); + } + } + + if (event->key() == Qt::Key_Right) { + if (m_timeLine.state() == QTimeLine::NotRunning) { + m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 + 1000); + m_timeLine.start(); + event->accept(); + } + } +} diff --git a/examples/effects/blurpicker/blurpicker.h b/examples/effects/blurpicker/blurpicker.h new file mode 100644 index 0000000..b7ea3b4 --- /dev/null +++ b/examples/effects/blurpicker/blurpicker.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef BLURPICKER_H +#define BLURPICKER_H + +#include +#include +#include + +#include "blureffect.h" + +class BlurPicker: public QGraphicsView +{ + Q_OBJECT + +public: + BlurPicker(QWidget *parent = 0); + +protected: + void keyPressEvent(QKeyEvent *event); + +private slots: + void updateIconPositions(); + +private: + void setupScene(); + +private: + qreal m_index; + QGraphicsScene m_scene; + QList m_icons; + QTimeLine m_timeLine; +}; + +#endif // BLURPICKER_H diff --git a/examples/effects/blurpicker/blurpicker.pro b/examples/effects/blurpicker/blurpicker.pro new file mode 100644 index 0000000..76537a9 --- /dev/null +++ b/examples/effects/blurpicker/blurpicker.pro @@ -0,0 +1,9 @@ +SOURCES += main.cpp blurpicker.cpp blureffect.cpp +HEADERS += blurpicker.h blureffect.h +RESOURCES += blurpicker.qrc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/effects/blurpicker +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS blurpicker.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/effects/blurpicker +INSTALLS += target sources diff --git a/examples/effects/blurpicker/blurpicker.qrc b/examples/effects/blurpicker/blurpicker.qrc new file mode 100644 index 0000000..e88eaca --- /dev/null +++ b/examples/effects/blurpicker/blurpicker.qrc @@ -0,0 +1,14 @@ + + + images/background.jpg + images/accessories-calculator.png + images/accessories-text-editor.png + images/help-browser.png + images/internet-group-chat.png + images/internet-mail.png + images/internet-web-browser.png + images/office-calendar.png + images/system-users.png + + + diff --git a/examples/effects/blurpicker/images/README.txt b/examples/effects/blurpicker/images/README.txt new file mode 100644 index 0000000..0927e17 --- /dev/null +++ b/examples/effects/blurpicker/images/README.txt @@ -0,0 +1,5 @@ +The background is taken from a public domain photo at: +http://www.photos8.com/view/computer_board2-800x600.html + +All other icons are from the Tango Desktop project: +http://tango.freedesktop.org/Tango_Desktop_Project diff --git a/examples/effects/blurpicker/images/accessories-calculator.png b/examples/effects/blurpicker/images/accessories-calculator.png new file mode 100644 index 0000000..4e7661f Binary files /dev/null and b/examples/effects/blurpicker/images/accessories-calculator.png differ diff --git a/examples/effects/blurpicker/images/accessories-text-editor.png b/examples/effects/blurpicker/images/accessories-text-editor.png new file mode 100644 index 0000000..33bef0b Binary files /dev/null and b/examples/effects/blurpicker/images/accessories-text-editor.png differ diff --git a/examples/effects/blurpicker/images/background.jpg b/examples/effects/blurpicker/images/background.jpg new file mode 100644 index 0000000..e75b388 Binary files /dev/null and b/examples/effects/blurpicker/images/background.jpg differ diff --git a/examples/effects/blurpicker/images/help-browser.png b/examples/effects/blurpicker/images/help-browser.png new file mode 100644 index 0000000..8ef4fae Binary files /dev/null and b/examples/effects/blurpicker/images/help-browser.png differ diff --git a/examples/effects/blurpicker/images/internet-group-chat.png b/examples/effects/blurpicker/images/internet-group-chat.png new file mode 100644 index 0000000..dd92d93 Binary files /dev/null and b/examples/effects/blurpicker/images/internet-group-chat.png differ diff --git a/examples/effects/blurpicker/images/internet-mail.png b/examples/effects/blurpicker/images/internet-mail.png new file mode 100644 index 0000000..7e6b93b Binary files /dev/null and b/examples/effects/blurpicker/images/internet-mail.png differ diff --git a/examples/effects/blurpicker/images/internet-web-browser.png b/examples/effects/blurpicker/images/internet-web-browser.png new file mode 100644 index 0000000..a979a92 Binary files /dev/null and b/examples/effects/blurpicker/images/internet-web-browser.png differ diff --git a/examples/effects/blurpicker/images/office-calendar.png b/examples/effects/blurpicker/images/office-calendar.png new file mode 100644 index 0000000..e095906 Binary files /dev/null and b/examples/effects/blurpicker/images/office-calendar.png differ diff --git a/examples/effects/blurpicker/images/system-users.png b/examples/effects/blurpicker/images/system-users.png new file mode 100644 index 0000000..a7f630a Binary files /dev/null and b/examples/effects/blurpicker/images/system-users.png differ diff --git a/examples/effects/blurpicker/main.cpp b/examples/effects/blurpicker/main.cpp new file mode 100644 index 0000000..b88a51d --- /dev/null +++ b/examples/effects/blurpicker/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "blurpicker.h" +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + BlurPicker blurPicker; + blurPicker.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Application Picker")); + blurPicker.setFixedSize(400, 300); + blurPicker.show(); + + return app.exec(); +} diff --git a/examples/effects/effects.pro b/examples/effects/effects.pro new file mode 100644 index 0000000..8ba0324 --- /dev/null +++ b/examples/effects/effects.pro @@ -0,0 +1,12 @@ +TEMPLATE = \ + subdirs +SUBDIRS = \ + blurpicker \ + lighting + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/effects +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS effects.pro README +sources.path = $$[QT_INSTALL_EXAMPLES]/effects +INSTALLS += target sources + diff --git a/examples/effects/lighting/lighting.cpp b/examples/effects/lighting/lighting.cpp new file mode 100644 index 0000000..63f0a6c --- /dev/null +++ b/examples/effects/lighting/lighting.cpp @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "lighting.h" + +#include + +#include "shadoweffect.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +Lighting::Lighting(QWidget *parent): QGraphicsView(parent), angle(0.0) +{ + setScene(&m_scene); + + setupScene(); + + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), SLOT(animate())); + timer->setInterval(30); + timer->start(); + + setRenderHint(QPainter::Antialiasing, true); + setFrameStyle(QFrame::NoFrame); +} + +void Lighting::setupScene() +{ + m_scene.setSceneRect(-300, -200, 600, 460); + + QLinearGradient linearGrad(QPointF(-100, -100), QPointF(100, 100)); + linearGrad.setColorAt(0, QColor(255, 255, 255)); + linearGrad.setColorAt(1, QColor(192, 192, 255)); + setBackgroundBrush(linearGrad); + + QRadialGradient radialGrad(30, 30, 30); + radialGrad.setColorAt(0, Qt::yellow); + radialGrad.setColorAt(0.2, Qt::yellow); + radialGrad.setColorAt(1, Qt::transparent); + QPixmap pixmap(60, 60); + pixmap.fill(Qt::transparent); + QPainter painter(&pixmap); + painter.setPen(Qt::NoPen); + painter.setBrush(radialGrad); + painter.drawEllipse(0, 0, 60, 60); + painter.end(); + + m_lightSource = m_scene.addPixmap(pixmap); + m_lightSource->setZValue(2); + + for (int i = -2; i < 3; ++i) + for (int j = -2; j < 3; ++j) { + QAbstractGraphicsShapeItem *item; + if ((i + j) & 1) + item = new QGraphicsEllipseItem(0, 0, 50, 50); + else + item = new QGraphicsRectItem(0, 0, 50, 50); + + item->setPen(QPen(Qt::black)); + item->setBrush(QBrush(Qt::white)); + item->setGraphicsEffect(new ShadowEffect(item, m_lightSource)); + item->setZValue(1); + item->setPos(i * 80, j * 80); + m_scene.addItem(item); + m_items << item; + } + + +} + +void Lighting::animate() +{ + angle += (M_PI / 30); + qreal xs = 200 * sin(angle) - 40 + 25; + qreal ys = 200 * cos(angle) - 40 + 25; + m_lightSource->setPos(xs, ys); + m_scene.update(); +} + diff --git a/examples/effects/lighting/lighting.h b/examples/effects/lighting/lighting.h new file mode 100644 index 0000000..70a4d48 --- /dev/null +++ b/examples/effects/lighting/lighting.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LIGHTING_H +#define LIGHTING_H + +#include +#include + +#include "shadoweffect.h" + +class Lighting: public QGraphicsView +{ + Q_OBJECT + +public: + Lighting(QWidget *parent = 0); + +private slots: + void animate(); + +private: + void setupScene(); + +private: + qreal angle; + QGraphicsScene m_scene; + QGraphicsItem *m_lightSource; + QList m_items; +}; + +#endif // LIGHTING_H diff --git a/examples/effects/lighting/lighting.pro b/examples/effects/lighting/lighting.pro new file mode 100644 index 0000000..ea9d5f6 --- /dev/null +++ b/examples/effects/lighting/lighting.pro @@ -0,0 +1,8 @@ +SOURCES += main.cpp lighting.cpp shadoweffect.cpp +HEADERS += lighting.h shadoweffect.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/effects/lighting +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS lighting.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/effects/lighting +INSTALLS += target sources diff --git a/examples/effects/lighting/main.cpp b/examples/effects/lighting/main.cpp new file mode 100644 index 0000000..07415f6 --- /dev/null +++ b/examples/effects/lighting/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "lighting.h" +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + Lighting lighting; + lighting.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Lighting and Shadows")); + lighting.resize(640, 480); + lighting.show(); + + return app.exec(); +} diff --git a/examples/effects/lighting/shadoweffect.cpp b/examples/effects/lighting/shadoweffect.cpp new file mode 100644 index 0000000..f447531 --- /dev/null +++ b/examples/effects/lighting/shadoweffect.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "shadoweffect.h" + +#include + +ShadowEffect::ShadowEffect(QGraphicsItem *item, QGraphicsItem *source) + : QGraphicsShadowEffect() + , item(item), m_lightSource(source) +{ + setBlurRadius(8); +} + +void ShadowEffect::adjustForItem() +{ + QPointF delta = item->pos() - m_lightSource->pos(); + setShadowOffset(delta.toPoint() / 30); + + qreal dx = delta.x(); + qreal dy = delta.y(); + qreal dd = sqrt(dx * dx + dy * dy); + setOpacity(qBound(0.4, 1 - dd / 200.0, 0.7)); +} + +QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const +{ + const_cast(this)->adjustForItem(); + return QGraphicsShadowEffect::boundingRectFor(rect); +} + +void ShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +{ + adjustForItem(); + QGraphicsShadowEffect::draw(painter, source); +} diff --git a/examples/effects/lighting/shadoweffect.h b/examples/effects/lighting/shadoweffect.h new file mode 100644 index 0000000..68318b0 --- /dev/null +++ b/examples/effects/lighting/shadoweffect.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SHADOWEFFECT_H +#define SHADOWEFFECT_H + +#include +#include + +class ShadowEffect: public QGraphicsShadowEffect +{ +public: + ShadowEffect(QGraphicsItem *item, QGraphicsItem *source); + + QRectF boundingRectFor(const QRectF &rect) const; + + void draw(QPainter *painter, QGraphicsEffectSource *source); + +private: + void adjustForItem(); + +private: + QGraphicsItem *item; + QGraphicsItem *m_lightSource; +}; + +#endif // SHADOWEFFECT_H diff --git a/examples/examples.pro b/examples/examples.pro index e6cece9..197e80f 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -4,6 +4,7 @@ SUBDIRS = \ desktop \ dialogs \ draganddrop \ + effects \ graphicsview \ ipc \ itemviews \ diff --git a/examples/graphicsview/blurpicker/blureffect.cpp b/examples/graphicsview/blurpicker/blureffect.cpp deleted file mode 100644 index 82be44f..0000000 --- a/examples/graphicsview/blurpicker/blureffect.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "blureffect.h" - -#include - -BlurEffect::BlurEffect(QGraphicsItem *item) - : QGraphicsBlurEffect() - , m_baseLine(200), item(item) -{ -} - -void BlurEffect::adjustForItem() -{ - qreal y = m_baseLine - item->pos().y(); - qreal radius = qBound(0.0, y / 32, 16.0); - setBlurRadius(radius); -} - -QRectF BlurEffect::boundingRect() const -{ - const_cast(this)->adjustForItem(); - return QGraphicsBlurEffect::boundingRect(); -} - -void BlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) -{ - adjustForItem(); - QGraphicsBlurEffect::draw(painter, source); -} diff --git a/examples/graphicsview/blurpicker/blureffect.h b/examples/graphicsview/blurpicker/blureffect.h deleted file mode 100644 index 89694b6..0000000 --- a/examples/graphicsview/blurpicker/blureffect.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BLUREFFECT_H -#define BLUREFFECT_H - -#include -#include - -class BlurEffect: public QGraphicsBlurEffect -{ -public: - BlurEffect(QGraphicsItem *item); - - void setBaseLine(qreal y) { m_baseLine = y; } - - QRectF boundingRect() const; - - void draw(QPainter *painter, QGraphicsEffectSource *source); - -private: - void adjustForItem(); - -private: - qreal m_baseLine; - QGraphicsItem *item; -}; - -#endif // BLUREFFECT_H diff --git a/examples/graphicsview/blurpicker/blurpicker.cpp b/examples/graphicsview/blurpicker/blurpicker.cpp deleted file mode 100644 index 9904dfa..0000000 --- a/examples/graphicsview/blurpicker/blurpicker.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "blurpicker.h" - -#include - -#include "blureffect.h" - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0) -{ - setBackgroundBrush(QPixmap(":/images/background.jpg")); - setScene(&m_scene); - - setupScene(); - updateIconPositions(); - - connect(&m_timeLine, SIGNAL(valueChanged(qreal)), SLOT(updateIconPositions())); - m_timeLine.setDuration(400); - - setRenderHint(QPainter::Antialiasing, true); - setFrameStyle(QFrame::NoFrame); -} - -void BlurPicker::updateIconPositions() -{ - m_index = m_timeLine.currentFrame() / 1000.0; - - qreal baseline = 0; - for (int i = 0; i < m_icons.count(); ++i) { - QGraphicsItem *icon = m_icons[i]; - qreal a = ((i + m_index) * 2 * M_PI) / m_icons.count(); - qreal xs = 170 * sin(a); - qreal ys = 100 * cos(a); - QPointF pos(xs, ys); - pos = QTransform().rotate(-20).map(pos); - pos -= QPointF(40, 40); - icon->setPos(pos); - baseline = qMax(baseline, ys); - static_cast(icon->graphicsEffect())->setBaseLine(baseline); - } - - m_scene.update(); -} - -void BlurPicker::setupScene() -{ - m_scene.setSceneRect(-200, -120, 400, 240); - - QStringList names; - names << ":/images/accessories-calculator.png"; - names << ":/images/accessories-text-editor.png"; - names << ":/images/help-browser.png"; - names << ":/images/internet-group-chat.png"; - names << ":/images/internet-mail.png"; - names << ":/images/internet-web-browser.png"; - names << ":/images/office-calendar.png"; - names << ":/images/system-users.png"; - - for (int i = 0; i < names.count(); i++) { - QPixmap pixmap(names[i]); - QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap); - icon->setZValue(1); - icon->setGraphicsEffect(new BlurEffect(icon)); - m_icons << icon; - } - - QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/images/background.jpg")); - bg->setZValue(0); - bg->setPos(-200, -150); -} - -void BlurPicker::keyPressEvent(QKeyEvent *event) -{ - if (event->key() == Qt::Key_Left) { - if (m_timeLine.state() == QTimeLine::NotRunning) { - m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 - 1000); - m_timeLine.start(); - event->accept(); - } - } - - if (event->key() == Qt::Key_Right) { - if (m_timeLine.state() == QTimeLine::NotRunning) { - m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 + 1000); - m_timeLine.start(); - event->accept(); - } - } -} diff --git a/examples/graphicsview/blurpicker/blurpicker.h b/examples/graphicsview/blurpicker/blurpicker.h deleted file mode 100644 index b7ea3b4..0000000 --- a/examples/graphicsview/blurpicker/blurpicker.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BLURPICKER_H -#define BLURPICKER_H - -#include -#include -#include - -#include "blureffect.h" - -class BlurPicker: public QGraphicsView -{ - Q_OBJECT - -public: - BlurPicker(QWidget *parent = 0); - -protected: - void keyPressEvent(QKeyEvent *event); - -private slots: - void updateIconPositions(); - -private: - void setupScene(); - -private: - qreal m_index; - QGraphicsScene m_scene; - QList m_icons; - QTimeLine m_timeLine; -}; - -#endif // BLURPICKER_H diff --git a/examples/graphicsview/blurpicker/blurpicker.pro b/examples/graphicsview/blurpicker/blurpicker.pro deleted file mode 100644 index e42cc0f..0000000 --- a/examples/graphicsview/blurpicker/blurpicker.pro +++ /dev/null @@ -1,9 +0,0 @@ -SOURCES += main.cpp blurpicker.cpp blureffect.cpp -HEADERS += blurpicker.h blureffect.h -RESOURCES += blurpicker.qrc - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/blurpicker -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS blurpicker.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/blurpicker -INSTALLS += target sources diff --git a/examples/graphicsview/blurpicker/blurpicker.qrc b/examples/graphicsview/blurpicker/blurpicker.qrc deleted file mode 100644 index e88eaca..0000000 --- a/examples/graphicsview/blurpicker/blurpicker.qrc +++ /dev/null @@ -1,14 +0,0 @@ - - - images/background.jpg - images/accessories-calculator.png - images/accessories-text-editor.png - images/help-browser.png - images/internet-group-chat.png - images/internet-mail.png - images/internet-web-browser.png - images/office-calendar.png - images/system-users.png - - - diff --git a/examples/graphicsview/blurpicker/images/README.txt b/examples/graphicsview/blurpicker/images/README.txt deleted file mode 100644 index 0927e17..0000000 --- a/examples/graphicsview/blurpicker/images/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -The background is taken from a public domain photo at: -http://www.photos8.com/view/computer_board2-800x600.html - -All other icons are from the Tango Desktop project: -http://tango.freedesktop.org/Tango_Desktop_Project diff --git a/examples/graphicsview/blurpicker/images/accessories-calculator.png b/examples/graphicsview/blurpicker/images/accessories-calculator.png deleted file mode 100644 index 4e7661f..0000000 Binary files a/examples/graphicsview/blurpicker/images/accessories-calculator.png and /dev/null differ diff --git a/examples/graphicsview/blurpicker/images/accessories-text-editor.png b/examples/graphicsview/blurpicker/images/accessories-text-editor.png deleted file mode 100644 index 33bef0b..0000000 Binary files a/examples/graphicsview/blurpicker/images/accessories-text-editor.png and /dev/null differ diff --git a/examples/graphicsview/blurpicker/images/background.jpg b/examples/graphicsview/blurpicker/images/background.jpg deleted file mode 100644 index e75b388..0000000 Binary files a/examples/graphicsview/blurpicker/images/background.jpg and /dev/null differ diff --git a/examples/graphicsview/blurpicker/images/help-browser.png b/examples/graphicsview/blurpicker/images/help-browser.png deleted file mode 100644 index 8ef4fae..0000000 Binary files a/examples/graphicsview/blurpicker/images/help-browser.png and /dev/null differ diff --git a/examples/graphicsview/blurpicker/images/internet-group-chat.png b/examples/graphicsview/blurpicker/images/internet-group-chat.png deleted file mode 100644 index dd92d93..0000000 Binary files a/examples/graphicsview/blurpicker/images/internet-group-chat.png and /dev/null differ diff --git a/examples/graphicsview/blurpicker/images/internet-mail.png b/examples/graphicsview/blurpicker/images/internet-mail.png deleted file mode 100644 index 7e6b93b..0000000 Binary files a/examples/graphicsview/blurpicker/images/internet-mail.png and /dev/null differ diff --git a/examples/graphicsview/blurpicker/images/internet-web-browser.png b/examples/graphicsview/blurpicker/images/internet-web-browser.png deleted file mode 100644 index a979a92..0000000 Binary files a/examples/graphicsview/blurpicker/images/internet-web-browser.png and /dev/null differ diff --git a/examples/graphicsview/blurpicker/images/office-calendar.png b/examples/graphicsview/blurpicker/images/office-calendar.png deleted file mode 100644 index e095906..0000000 Binary files a/examples/graphicsview/blurpicker/images/office-calendar.png and /dev/null differ diff --git a/examples/graphicsview/blurpicker/images/system-users.png b/examples/graphicsview/blurpicker/images/system-users.png deleted file mode 100644 index a7f630a..0000000 Binary files a/examples/graphicsview/blurpicker/images/system-users.png and /dev/null differ diff --git a/examples/graphicsview/blurpicker/main.cpp b/examples/graphicsview/blurpicker/main.cpp deleted file mode 100644 index b88a51d..0000000 --- a/examples/graphicsview/blurpicker/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "blurpicker.h" -#include - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - BlurPicker blurPicker; - blurPicker.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Application Picker")); - blurPicker.setFixedSize(400, 300); - blurPicker.show(); - - return app.exec(); -} diff --git a/examples/graphicsview/graphicsview.pro b/examples/graphicsview/graphicsview.pro index 4dd0b13..7c8e787 100644 --- a/examples/graphicsview/graphicsview.pro +++ b/examples/graphicsview/graphicsview.pro @@ -6,8 +6,6 @@ SUBDIRS = \ diagramscene \ dragdroprobot \ padnavigator \ - lighting \ - blurpicker \ basicgraphicslayouts contains(QT_CONFIG, qt3support):SUBDIRS += portedcanvas portedasteroids diff --git a/examples/graphicsview/lighting/lighting.cpp b/examples/graphicsview/lighting/lighting.cpp deleted file mode 100644 index 63f0a6c..0000000 --- a/examples/graphicsview/lighting/lighting.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "lighting.h" - -#include - -#include "shadoweffect.h" - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -Lighting::Lighting(QWidget *parent): QGraphicsView(parent), angle(0.0) -{ - setScene(&m_scene); - - setupScene(); - - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(animate())); - timer->setInterval(30); - timer->start(); - - setRenderHint(QPainter::Antialiasing, true); - setFrameStyle(QFrame::NoFrame); -} - -void Lighting::setupScene() -{ - m_scene.setSceneRect(-300, -200, 600, 460); - - QLinearGradient linearGrad(QPointF(-100, -100), QPointF(100, 100)); - linearGrad.setColorAt(0, QColor(255, 255, 255)); - linearGrad.setColorAt(1, QColor(192, 192, 255)); - setBackgroundBrush(linearGrad); - - QRadialGradient radialGrad(30, 30, 30); - radialGrad.setColorAt(0, Qt::yellow); - radialGrad.setColorAt(0.2, Qt::yellow); - radialGrad.setColorAt(1, Qt::transparent); - QPixmap pixmap(60, 60); - pixmap.fill(Qt::transparent); - QPainter painter(&pixmap); - painter.setPen(Qt::NoPen); - painter.setBrush(radialGrad); - painter.drawEllipse(0, 0, 60, 60); - painter.end(); - - m_lightSource = m_scene.addPixmap(pixmap); - m_lightSource->setZValue(2); - - for (int i = -2; i < 3; ++i) - for (int j = -2; j < 3; ++j) { - QAbstractGraphicsShapeItem *item; - if ((i + j) & 1) - item = new QGraphicsEllipseItem(0, 0, 50, 50); - else - item = new QGraphicsRectItem(0, 0, 50, 50); - - item->setPen(QPen(Qt::black)); - item->setBrush(QBrush(Qt::white)); - item->setGraphicsEffect(new ShadowEffect(item, m_lightSource)); - item->setZValue(1); - item->setPos(i * 80, j * 80); - m_scene.addItem(item); - m_items << item; - } - - -} - -void Lighting::animate() -{ - angle += (M_PI / 30); - qreal xs = 200 * sin(angle) - 40 + 25; - qreal ys = 200 * cos(angle) - 40 + 25; - m_lightSource->setPos(xs, ys); - m_scene.update(); -} - diff --git a/examples/graphicsview/lighting/lighting.h b/examples/graphicsview/lighting/lighting.h deleted file mode 100644 index 70a4d48..0000000 --- a/examples/graphicsview/lighting/lighting.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef LIGHTING_H -#define LIGHTING_H - -#include -#include - -#include "shadoweffect.h" - -class Lighting: public QGraphicsView -{ - Q_OBJECT - -public: - Lighting(QWidget *parent = 0); - -private slots: - void animate(); - -private: - void setupScene(); - -private: - qreal angle; - QGraphicsScene m_scene; - QGraphicsItem *m_lightSource; - QList m_items; -}; - -#endif // LIGHTING_H diff --git a/examples/graphicsview/lighting/lighting.pro b/examples/graphicsview/lighting/lighting.pro deleted file mode 100644 index 440bb53..0000000 --- a/examples/graphicsview/lighting/lighting.pro +++ /dev/null @@ -1,8 +0,0 @@ -SOURCES += main.cpp lighting.cpp shadoweffect.cpp -HEADERS += lighting.h shadoweffect.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/lighting -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS lighting.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/lighting -INSTALLS += target sources diff --git a/examples/graphicsview/lighting/main.cpp b/examples/graphicsview/lighting/main.cpp deleted file mode 100644 index 07415f6..0000000 --- a/examples/graphicsview/lighting/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "lighting.h" -#include - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - Lighting lighting; - lighting.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Lighting and Shadows")); - lighting.resize(640, 480); - lighting.show(); - - return app.exec(); -} diff --git a/examples/graphicsview/lighting/shadoweffect.cpp b/examples/graphicsview/lighting/shadoweffect.cpp deleted file mode 100644 index f447531..0000000 --- a/examples/graphicsview/lighting/shadoweffect.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "shadoweffect.h" - -#include - -ShadowEffect::ShadowEffect(QGraphicsItem *item, QGraphicsItem *source) - : QGraphicsShadowEffect() - , item(item), m_lightSource(source) -{ - setBlurRadius(8); -} - -void ShadowEffect::adjustForItem() -{ - QPointF delta = item->pos() - m_lightSource->pos(); - setShadowOffset(delta.toPoint() / 30); - - qreal dx = delta.x(); - qreal dy = delta.y(); - qreal dd = sqrt(dx * dx + dy * dy); - setOpacity(qBound(0.4, 1 - dd / 200.0, 0.7)); -} - -QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const -{ - const_cast(this)->adjustForItem(); - return QGraphicsShadowEffect::boundingRectFor(rect); -} - -void ShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source) -{ - adjustForItem(); - QGraphicsShadowEffect::draw(painter, source); -} diff --git a/examples/graphicsview/lighting/shadoweffect.h b/examples/graphicsview/lighting/shadoweffect.h deleted file mode 100644 index 68318b0..0000000 --- a/examples/graphicsview/lighting/shadoweffect.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SHADOWEFFECT_H -#define SHADOWEFFECT_H - -#include -#include - -class ShadowEffect: public QGraphicsShadowEffect -{ -public: - ShadowEffect(QGraphicsItem *item, QGraphicsItem *source); - - QRectF boundingRectFor(const QRectF &rect) const; - - void draw(QPainter *painter, QGraphicsEffectSource *source); - -private: - void adjustForItem(); - -private: - QGraphicsItem *item; - QGraphicsItem *m_lightSource; -}; - -#endif // SHADOWEFFECT_H -- cgit v0.12