• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
  • animations
water.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 Bruno Abinader <bruno.abinader@indt.org.br>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <plasma/private/effects/ripple_p.h>
19#include "water_p.h"
20
21namespace Plasma
22{
23
24WaterAnimation::WaterAnimation(QObject *parent)
25 : EasingAnimation(parent),
26 m_offset(1)
27{
28}
29
30qint8 WaterAnimation::offset() const
31{
32 return m_offset;
33}
34
35void WaterAnimation::setOffset(qint8 offset)
36{
37 m_offset = offset;
38}
39
40void WaterAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
41{
42 QGraphicsWidget *widget = targetWidget();
43 if (!widget) {
44 return;
45 }
46
47 RippleEffect *effect = qobject_cast<RippleEffect*>(widget->graphicsEffect());
48 if (!effect) {
49 effect = new RippleEffect(widget);
50 widget->setGraphicsEffect(effect);
51 }
52
53 if (oldState == Stopped && newState == Running) {
54 effect->setOffset(m_offset);
55 effect->setEnabled(true);
56 } else if (newState == Stopped) {
57 effect->setEnabled(false);
58 }
59}
60
61void WaterAnimation::updateEffectiveTime(int currentTime)
62{
63 QGraphicsWidget *widget = targetWidget();
64 if (widget && widget->graphicsEffect()) {
65 widget->graphicsEffect()->setProperty("opacity", currentTime / qreal(duration()));
66 }
67}
68
69} // namespace Plasma
QGraphicsWidget
QObject
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal