bar.cpp
54 lines
| 1.5 KiB
| text/x-c
|
CppLexer
Jani Honkonen
|
r794 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 Digia Plc | ||||
** All rights reserved. | ||||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
** This file is part of the Qt Commercial Charts Add-on. | ||||
** | ||||
** $QT_BEGIN_LICENSE$ | ||||
** Licensees holding valid Qt Commercial licenses may use this file in | ||||
** accordance with the Qt Commercial License Agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and Digia. | ||||
** | ||||
** If you have questions regarding the use of this file, please use | ||||
** contact form at http://qt.digia.com | ||||
** $QT_END_LICENSE$ | ||||
** | ||||
****************************************************************************/ | ||||
sauimone
|
r118 | #include "bar_p.h" | ||
sauimone
|
r56 | #include <QDebug> | ||
Michal Klocek
|
r59 | #include <QPainter> | ||
sauimone
|
r283 | #include <QGraphicsSceneEvent> | ||
sauimone
|
r56 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
sauimone
|
r425 | Bar::Bar(QString category, QGraphicsItem *parent) | ||
Michal Klocek
|
r679 | : QGraphicsRectItem(parent), | ||
sauimone
|
r763 | m_category(category) | ||
sauimone
|
r56 | { | ||
Tero Ahola
|
r737 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); | ||
sauimone
|
r280 | setAcceptHoverEvents(true); | ||
sauimone
|
r56 | } | ||
Tero Ahola
|
r737 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) | ||
sauimone
|
r256 | { | ||
sauimone
|
r812 | emit clicked(m_category, event->button()); | ||
sauimone
|
r256 | } | ||
Tero Ahola
|
r737 | void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) | ||
sauimone
|
r276 | { | ||
sauimone
|
r283 | emit hoverEntered(event->lastScreenPos()); | ||
sauimone
|
r276 | } | ||
Tero Ahola
|
r737 | void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | ||
sauimone
|
r276 | { | ||
Tero Ahola
|
r737 | Q_UNUSED(event) | ||
sauimone
|
r283 | emit hoverLeaved(); | ||
sauimone
|
r276 | } | ||
sauimone
|
r256 | #include "moc_bar_p.cpp" | ||
sauimone
|
r239 | |||
sauimone
|
r56 | QTCOMMERCIALCHART_END_NAMESPACE | ||