10#include "LineGridNode.h"
13LinePropertiesGroup::LinePropertiesGroup(
GridLines *parent)
19bool LinePropertiesGroup::visible()
const
24void LinePropertiesGroup::setVisible(
bool newVisible)
26 if (newVisible == m_visible) {
30 m_visible = newVisible;
31 Q_EMIT propertiesChanged();
34QColor LinePropertiesGroup::color()
const
39void LinePropertiesGroup::setColor(
const QColor &newColor)
41 if (newColor == m_color) {
46 Q_EMIT propertiesChanged();
49float LinePropertiesGroup::lineWidth()
const
54void LinePropertiesGroup::setLineWidth(
float newLineWidth)
56 if (newLineWidth == m_lineWidth) {
60 m_lineWidth = newLineWidth;
61 Q_EMIT propertiesChanged();
64int LinePropertiesGroup::frequency()
const
69void LinePropertiesGroup::setFrequency(
int newFrequency)
71 if (newFrequency == m_frequency) {
75 m_frequency = newFrequency;
76 Q_EMIT propertiesChanged();
79int LinePropertiesGroup::count()
const
84void LinePropertiesGroup::setCount(
int newCount)
86 if (newCount == m_count) {
91 Q_EMIT propertiesChanged();
99 m_major = std::make_unique<LinePropertiesGroup>(
this);
101 m_minor = std::make_unique<LinePropertiesGroup>(
this);
105GridLines::Direction GridLines::direction()
const
110void GridLines::setDirection(GridLines::Direction newDirection)
112 if (newDirection == m_direction) {
116 m_direction = newDirection;
118 Q_EMIT directionChanged();
121XYChart *GridLines::chart()
const
126void GridLines::setChart(
XYChart *newChart)
128 if (newChart == m_chart) {
146float GridLines::spacing()
const
151void GridLines::setSpacing(
float newSpacing)
153 if (newSpacing == m_spacing || m_chart !=
nullptr) {
157 m_spacing = newSpacing;
162LinePropertiesGroup *GridLines::majorGroup()
const
164 return m_major.get();
167LinePropertiesGroup *GridLines::minorGroup()
const
169 return m_minor.get();
172QSGNode *GridLines::updatePaintNode(
QSGNode *node, QQuickItem::UpdatePaintNodeData *)
181 if (m_direction == Direction::Horizontal) {
194void GridLines::updateLines(
LineGridNode *node, LinePropertiesGroup *properties)
198 node->setVertical(m_direction == Direction::Vertical);
204 node->setSpacing(m_spacing *
properties->frequency());
209#include "moc_GridLines.cpp"
An item that renders a set of lines to make a grid for a chart.
GridLines(QQuickItem *parent=nullptr)
Default constructor.
A base class for Charts that are based on an X/Y grid.
Q_SIGNAL void computedRangeChanged()
Emitted whenever the complete range is recalculated.
ComputedRange computedRange() const
Get the complete, calculated range for this chart.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
virtual QRectF boundingRect() const const
void setFlag(Flag flag, bool enabled)
void appendChildNode(QSGNode *node)
QSGNode * childAtIndex(int i) const const