##// END OF EJS Templates
Added option to set labels clipping...
Added option to set labels clipping It's now possible to enable and disable the point label clipping. The clipping is enabled by default. Clipping cuts the point labels on the edge of the plot area. Change-Id: Ifaa6017b4c6d55fe030effeec8b336a7fc317adf Task-number: QTRD-3520 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2776:bc1f6aa59d42
r2815:4c1d3bc34edb
Show More
bar.cpp
92 lines | 2.5 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
Titta Heikkala
Copyright header changes...
r2776 ** Copyright (C) 2015 The Qt Company Ltd
Jani Honkonen
Add license headers
r794 ** All rights reserved.
Titta Heikkala
Copyright header changes...
r2776 ** For any questions to The Qt Company, please use contact form at http://qt.io
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2740 ** Licensees holding valid commercial license for Qt may use this file in
** accordance with the Qt License Agreement provided with the Software
** or, alternatively, in accordance with the terms contained in a written
Titta Heikkala
Copyright header changes...
r2776 ** agreement between you and The Qt Company.
Jani Honkonen
Add license headers
r794 **
** If you have questions regarding the use of this file, please use
Titta Heikkala
Updated license headers...
r2740 ** contact form at http://qt.io
Jani Honkonen
Add license headers
r794 **
****************************************************************************/
Titta Heikkala
Fix include syntax...
r2714 #include <private/bar_p.h>
#include <QtGui/QPainter>
#include <QtWidgets/QGraphicsSceneEvent>
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 #include <QtWidgets/QStyleOptionGraphicsItem>
#include <QtWidgets/QStyle>
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
sauimone
removed categories from barseries. categories are now only on axis
r1321 Bar::Bar(QBarSet *barset, int index, QGraphicsItem *parent) : QGraphicsRectItem(parent),
m_index(index),
sauimone
removed double signal emitting from barseries/set
r1563 m_barset(barset),
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 m_hovering(false),
m_mousePressed(false)
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 {
sauimone
removed categories from barseries. categories are now only on axis
r1321 setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
sauimone
barcharts: added legend to model. added signals for hover events (for tooltip). updated examples
r280 setAcceptHoverEvents(true);
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 setFlag(QGraphicsItem::ItemIsSelectable);
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 }
sauimone
removed double signal emitting from barseries/set
r1563 Bar::~Bar()
{
// End hover event, if bar is deleted during it
Titta Heikkala
Removed the old hovered signal from bar chart...
r2726 if (m_hovering)
Titta Heikkala
Add hovered signal with index for bar charts...
r2600 emit hovered(false, m_index, m_barset);
sauimone
removed double signal emitting from barseries/set
r1563 }
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737 void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event)
sauimone
Bug fix for bar presenters. It appears that order of childItems may change. Relying on order caused crash
r256 {
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 emit pressed(m_index, m_barset);
m_mousePressed = true;
Michal Klocek
Fixes mouse handling in base class of chartseries
r1747 QGraphicsItem::mousePressEvent(event);
sauimone
Bug fix for bar presenters. It appears that order of childItems may change. Relying on order caused crash
r256 }
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737 void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
sauimone
updated barchart examples. minor fixes
r276 {
Jani Honkonen
warnings are errors
r978 Q_UNUSED(event)
sauimone
removed double signal emitting from barseries/set
r1563 m_hovering = true;
Titta Heikkala
Add hovered signal with index for bar charts...
r2600 emit hovered(true, m_index, m_barset);
Michal Klocek
Fixes mouse handling in base class of chartseries
r1747
sauimone
updated barchart examples. minor fixes
r276 }
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737 void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
sauimone
updated barchart examples. minor fixes
r276 {
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737 Q_UNUSED(event)
sauimone
removed double signal emitting from barseries/set
r1563 m_hovering = false;
Titta Heikkala
Add hovered signal with index for bar charts...
r2600 emit hovered(false, m_index, m_barset);
sauimone
updated barchart examples. minor fixes
r276 }
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 void Bar::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
emit released(m_index, m_barset);
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 if (m_mousePressed)
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 emit clicked(m_index, m_barset);
m_mousePressed = false;
QGraphicsItem::mouseReleaseEvent(event);
}
void Bar::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
emit doubleClicked(m_index, m_barset);
QGraphicsItem::mouseDoubleClickEvent(event);
}
void Bar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
// Remove selection border around bar
QStyleOptionGraphicsItem barOption(*option);
barOption.state &= ~QStyle::State_Selected;
QGraphicsRectItem::paint(painter, &barOption, widget);
}
sauimone
Bug fix for bar presenters. It appears that order of childItems may change. Relying on order caused crash
r256 #include "moc_bar_p.cpp"
sauimone
signals and slots for bars and sets
r239
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE