barvalue.cpp
89 lines
| 2.0 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
|
r263 | #include "barvalue_p.h" | ||
#include <QPainter> | ||||
#include <QPen> | ||||
sauimone
|
r811 | #include <QGraphicsSimpleTextItem> | ||
sauimone
|
r263 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
sauimone
|
r811 | BarValue::BarValue(QBarSet &set, QGraphicsItem *parent) : QGraphicsObject(parent), | ||
sauimone
|
r763 | m_barSet(set), | ||
sauimone
|
r811 | m_textItem(new QGraphicsSimpleTextItem(this)) | ||
sauimone
|
r263 | { | ||
sauimone
|
r813 | // connect(&set,SIGNAL(valuesVisibleChanged(bool)),value,SLOT(valuesVisibleChanged(bool))); | ||
sauimone
|
r273 | setVisible(false); | ||
sauimone
|
r263 | } | ||
sauimone
|
r776 | void BarValue::setText(QString str) | ||
sauimone
|
r263 | { | ||
sauimone
|
r811 | m_textItem->setText(str); | ||
sauimone
|
r263 | } | ||
sauimone
|
r776 | QString BarValue::text() const | ||
sauimone
|
r263 | { | ||
sauimone
|
r811 | return m_textItem->text(); | ||
sauimone
|
r263 | } | ||
sauimone
|
r776 | void BarValue::setPen(const QPen &pen) | ||
sauimone
|
r263 | { | ||
sauimone
|
r811 | m_textItem->setPen(pen); | ||
sauimone
|
r263 | } | ||
sauimone
|
r473 | QPen BarValue::pen() const | ||
sauimone
|
r263 | { | ||
sauimone
|
r811 | return m_textItem->pen(); | ||
sauimone
|
r263 | } | ||
sauimone
|
r811 | void BarValue::setFont(const QFont &font) | ||
sauimone
|
r263 | { | ||
sauimone
|
r811 | m_textItem->setFont(font); | ||
} | ||||
QFont BarValue::font() const | ||||
{ | ||||
return m_textItem->font(); | ||||
sauimone
|
r263 | } | ||
void BarValue::setPos(qreal x, qreal y) | ||||
{ | ||||
sauimone
|
r811 | m_textItem->setPos(x,y); | ||
sauimone
|
r263 | } | ||
void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | ||||
{ | ||||
Tero Ahola
|
r816 | Q_UNUSED(painter) | ||
Tero Ahola
|
r611 | Q_UNUSED(option) | ||
Q_UNUSED(widget) | ||||
sauimone
|
r263 | } | ||
QRectF BarValue::boundingRect() const | ||||
{ | ||||
sauimone
|
r811 | return m_textItem->boundingRect(); | ||
sauimone
|
r263 | } | ||
sauimone
|
r813 | void BarValue::valuesVisibleChanged(bool visible) | ||
sauimone
|
r273 | { | ||
sauimone
|
r813 | setVisible(visible); | ||
sauimone
|
r273 | } | ||
sauimone
|
r263 | |||
sauimone
|
r273 | #include "moc_barvalue_p.cpp" | ||
sauimone
|
r263 | QTCOMMERCIALCHART_END_NAMESPACE | ||