qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
src
widget
tool
toolboxgraphicsitem.h
Go to the documentation of this file.
1
/*
2
Copyright © 2015-2019 by The qTox Project Contributors
3
4
This file is part of qTox, a Qt-based graphical interface for Tox.
5
6
qTox is libre software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
qTox is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with qTox. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <QGraphicsItemGroup>
23
#include <QObject>
24
#include <QPropertyAnimation>
25
26
class
ToolBoxGraphicsItem
final :
public
QObject,
public
QGraphicsItemGroup
27
{
28
Q_OBJECT
29
Q_PROPERTY(qreal
opacity
READ
opacity
WRITE setOpacity)
30
public
:
31
ToolBoxGraphicsItem
();
32
~ToolBoxGraphicsItem
();
33
34
void
paint
(QPainter* painter,
const
QStyleOptionGraphicsItem* option,
35
QWidget* widget)
final
;
36
37
protected
:
38
void
hoverEnterEvent
(QGraphicsSceneHoverEvent* event)
final
;
39
void
hoverLeaveEvent
(QGraphicsSceneHoverEvent* event)
final
;
40
41
private
:
42
void
startAnimation
(QAbstractAnimation::Direction direction);
43
44
QPropertyAnimation*
opacityAnimation
;
45
qreal
idleOpacity
= 0.0f;
46
qreal
activeOpacity
= 1.0f;
47
int
fadeTimeMs
= 300;
48
};
ToolBoxGraphicsItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) final
Definition:
toolboxgraphicsitem.cpp:57
ToolBoxGraphicsItem::startAnimation
void startAnimation(QAbstractAnimation::Direction direction)
Definition:
toolboxgraphicsitem.cpp:51
ToolBoxGraphicsItem
Definition:
toolboxgraphicsitem.h:26
ToolBoxGraphicsItem::idleOpacity
qreal idleOpacity
Definition:
toolboxgraphicsitem.h:45
ToolBoxGraphicsItem::activeOpacity
qreal activeOpacity
Definition:
toolboxgraphicsitem.h:46
ToolBoxGraphicsItem::fadeTimeMs
int fadeTimeMs
Definition:
toolboxgraphicsitem.h:47
ToolBoxGraphicsItem::hoverLeaveEvent
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) final
Definition:
toolboxgraphicsitem.cpp:45
ToolBoxGraphicsItem::opacityAnimation
QPropertyAnimation * opacityAnimation
Definition:
toolboxgraphicsitem.h:44
ToolBoxGraphicsItem::ToolBoxGraphicsItem
ToolBoxGraphicsItem()
Definition:
toolboxgraphicsitem.cpp:24
ToolBoxGraphicsItem::~ToolBoxGraphicsItem
~ToolBoxGraphicsItem()
Definition:
toolboxgraphicsitem.cpp:35
ToolBoxGraphicsItem::opacity
qreal opacity
Definition:
toolboxgraphicsitem.h:29
ToolBoxGraphicsItem::hoverEnterEvent
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) final
Definition:
toolboxgraphicsitem.cpp:39
Generated by
1.8.17