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