bar.cpp
59 lines
| 1.6 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
|
r968 | Bar::Bar(QBarSet *barset, QString category, QGraphicsItem *parent) : QGraphicsRectItem(parent), | ||
m_category(category), | ||||
m_barset(barset) | ||||
sauimone
|
r56 | { | ||
sauimone
|
r1145 | setAcceptedMouseButtons(Qt::LeftButton /*| Qt::RightButton*/); | ||
sauimone
|
r280 | setAcceptHoverEvents(true); | ||
sauimone
|
r56 | } | ||
Tero Ahola
|
r737 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) | ||
sauimone
|
r256 | { | ||
Jani Honkonen
|
r1011 | Q_UNUSED(event) | ||
sauimone
|
r1008 | emit clicked(m_category); | ||
emit clicked(m_barset, m_category); | ||||
sauimone
|
r256 | } | ||
Tero Ahola
|
r737 | void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) | ||
sauimone
|
r276 | { | ||
Jani Honkonen
|
r978 | Q_UNUSED(event) | ||
sauimone
|
r975 | emit hovered(true); | ||
emit hovered(m_barset, true); | ||||
sauimone
|
r276 | } | ||
Tero Ahola
|
r737 | void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | ||
sauimone
|
r276 | { | ||
Tero Ahola
|
r737 | Q_UNUSED(event) | ||
sauimone
|
r975 | emit hovered(false); | ||
emit hovered(m_barset, false); | ||||
sauimone
|
r276 | } | ||
sauimone
|
r256 | #include "moc_bar_p.cpp" | ||
sauimone
|
r239 | |||
sauimone
|
r56 | QTCOMMERCIALCHART_END_NAMESPACE | ||