bar.cpp
58 lines
| 1.6 KiB
| text/x-c
|
CppLexer
|
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$ | ||||
** | ||||
****************************************************************************/ | ||||
|
r118 | #include "bar_p.h" | ||
|
r59 | #include <QPainter> | ||
|
r283 | #include <QGraphicsSceneEvent> | ||
|
r56 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r1321 | Bar::Bar(QBarSet *barset, int index, QGraphicsItem *parent) : QGraphicsRectItem(parent), | ||
m_index(index), | ||||
|
r968 | m_barset(barset) | ||
|
r56 | { | ||
|
r1321 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); | ||
|
r280 | setAcceptHoverEvents(true); | ||
|
r56 | } | ||
|
r737 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) | ||
|
r256 | { | ||
|
r1011 | Q_UNUSED(event) | ||
|
r1321 | emit clicked(m_barset, m_index); | ||
|
r1490 | emit clicked(m_index); | ||
|
r256 | } | ||
|
r737 | void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) | ||
|
r276 | { | ||
|
r978 | Q_UNUSED(event) | ||
|
r975 | emit hovered(m_barset, true); | ||
|
r1490 | emit hovered(true); | ||
|
r276 | } | ||
|
r737 | void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | ||
|
r276 | { | ||
|
r737 | Q_UNUSED(event) | ||
|
r975 | emit hovered(m_barset, false); | ||
|
r1490 | emit hovered(false); | ||
|
r276 | } | ||
|
r256 | #include "moc_bar_p.cpp" | ||
|
r239 | |||
|
r56 | QTCOMMERCIALCHART_END_NAMESPACE | ||