##// END OF EJS Templates
correct x-positioning for barcharts
correct x-positioning for barcharts

File last commit:

r820:2bd79611bb1d
r1228:0d57f24390a8
Show More
barlabel.cpp
104 lines | 2.3 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
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
renamed barchart floating values with labels to be consistent with piechart
r820 #include "barlabel_p.h"
#include "chartpresenter_p.h"
#include <QBarSet>
sauimone
Floating values to bar charts
r263 #include <QPainter>
#include <QPen>
sauimone
simple text item for barvalue
r811 #include <QGraphicsSimpleTextItem>
sauimone
Floating values to bar charts
r263
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 BarLabel::BarLabel(QBarSet &barSet, QGraphicsItem *parent) : QGraphicsObject(parent),
m_barSet(barSet),
sauimone
simple text item for barvalue
r811 m_textItem(new QGraphicsSimpleTextItem(this))
sauimone
Floating values to bar charts
r263 {
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 // connect(&set,SIGNAL(labelsVisibleChanged(bool)),value,SLOT(labelsVisibleChanged(bool)));
setZValue(ChartPresenter::BarSeriesZValue + 1);
setVisible(barSet.labelsVisible());
setPen(Qt::NoPen);
setBrush(Qt::SolidPattern);
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 void BarLabel::setText(QString str)
sauimone
Floating values to bar charts
r263 {
sauimone
simple text item for barvalue
r811 m_textItem->setText(str);
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 QString BarLabel::text() const
sauimone
Floating values to bar charts
r263 {
sauimone
simple text item for barvalue
r811 return m_textItem->text();
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 void BarLabel::setPen(const QPen &pen)
sauimone
Floating values to bar charts
r263 {
sauimone
simple text item for barvalue
r811 m_textItem->setPen(pen);
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 QPen BarLabel::pen() const
sauimone
Floating values to bar charts
r263 {
sauimone
simple text item for barvalue
r811 return m_textItem->pen();
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 void BarLabel::setBrush(const QBrush &brush)
{
m_textItem->setBrush(brush);
}
QBrush BarLabel::brush() const
{
return m_textItem->brush();
}
void BarLabel::setFont(const QFont &font)
sauimone
Floating values to bar charts
r263 {
sauimone
simple text item for barvalue
r811 m_textItem->setFont(font);
}
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 QFont BarLabel::font() const
sauimone
simple text item for barvalue
r811 {
return m_textItem->font();
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 void BarLabel::setPos(qreal x, qreal y)
sauimone
Floating values to bar charts
r263 {
sauimone
simple text item for barvalue
r811 m_textItem->setPos(x,y);
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 void BarLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
sauimone
Floating values to bar charts
r263 {
Tero Ahola
Warnings are errors, fixed one in barvalue.cpp
r816 Q_UNUSED(painter)
Tero Ahola
Squashed bunch of warnings
r611 Q_UNUSED(option)
Q_UNUSED(widget)
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 QRectF BarLabel::boundingRect() const
sauimone
Floating values to bar charts
r263 {
sauimone
simple text item for barvalue
r811 return m_textItem->boundingRect();
sauimone
Floating values to bar charts
r263 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 void BarLabel::labelsVisibleChanged(bool visible)
sauimone
floating values working now. bounding rect bug fixed
r273 {
sauimone
values visibility handling changed in barchart
r813 setVisible(visible);
sauimone
floating values working now. bounding rect bug fixed
r273 }
sauimone
Floating values to bar charts
r263
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 #include "moc_barlabel_p.cpp"
sauimone
Floating values to bar charts
r263 QTCOMMERCIALCHART_END_NAMESPACE