labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

DatapickerPoint.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  File : DatapickerPoint.cpp
3  Project : LabPlot
4  Description : Graphic Item for coordinate points of Datapicker
5  --------------------------------------------------------------------
6  Copyright : (C) 2015 by Ankit Wagadre (wagadre.ankit@gmail.com)
7  Copyright : (C) 2015-2019 Alexander Semke (alexander.semke@web.de)
8  ***************************************************************************/
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  * This program is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19  * GNU General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU General Public License *
22  * along with this program; if not, write to the Free Software *
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
24  * Boston, MA 02110-1301 USA *
25  * *
26  ***************************************************************************/
27 
28 #include "DatapickerPoint.h"
30 #include "DatapickerPointPrivate.h"
34 
35 #include <QPainter>
36 #include <QGraphicsScene>
37 #include <QMenu>
38 #include <QGraphicsSceneMouseEvent>
39 
40 #include <KConfig>
41 #include <KConfigGroup>
42 #include <KLocalizedString>
43 
44 /**
45  * \class ErrorBarItem
46  * \brief A customizable error-bar for DatapickerPoint.
47  */
48 
50  QGraphicsRectItem(parent->graphicsItem()),
51  barLineItem(new QGraphicsLineItem(parent->graphicsItem())),
52  m_type(type),
53  m_parentItem(parent) {
54  setFlag(QGraphicsItem::ItemIsMovable);
55  setFlag(QGraphicsItem::ItemIsSelectable);
56  setFlag(QGraphicsItem::ItemSendsGeometryChanges);
57  initRect();
58  setAcceptHoverEvents(true);
59 }
60 
62  QRectF xBarRect(-0.15, -0.5, 0.3, 1);
63  QRectF yBarRect(-0.5, -0.15, 1, 0.3);
64 
66  m_rect = xBarRect;
67  else
68  m_rect = yBarRect;
69 }
70 
71 void ErrorBarItem::setPosition(QPointF position) {
72  setPos(position);
73  barLineItem->setLine(0, 0, position.x(), position.y());
74 }
75 
76 void ErrorBarItem::setRectSize(qreal size) {
77  QMatrix matrix;
78  matrix.scale(size, size);
79  setRect(matrix.mapRect(m_rect));
80 }
81 
82 void ErrorBarItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) {
84  m_parentItem->setPlusDeltaXPos(pos());
86  m_parentItem->setMinusDeltaXPos(pos());
87  else if (m_type == ErrorBarType::PlusDeltaY)
88  m_parentItem->setPlusDeltaYPos(pos());
90  m_parentItem->setMinusDeltaYPos(pos());
91 
92  QGraphicsItem::mouseReleaseEvent(event);
93 }
94 
95 void ErrorBarItem::hoverEnterEvent(QGraphicsSceneHoverEvent*) {
97  setCursor(Qt::SizeHorCursor);
98  else
99  setCursor(Qt::SizeVerCursor);
100 }
101 
102 QVariant ErrorBarItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) {
103  if (change == QGraphicsItem::ItemPositionChange) {
104  QPointF newPos = value.toPointF();
106  newPos.setY(0);
107  barLineItem->setLine(0, 0, newPos.x(), 0);
108  } else {
109  newPos.setX(0);
110  barLineItem->setLine(0, 0, 0, newPos.y());
111  }
112  return QGraphicsRectItem::itemChange(change, newPos);
113  }
114 
115  return QGraphicsRectItem::itemChange(change, value);
116 }
117 
118 /**
119  * \class Datapicker-Point
120  * \brief A customizable symbol supports error-bars.
121  *
122  * The datapicker-Point is aligned relative to the specified position.
123  * The position can be either specified by mouse events or by providing the
124  * x- and y- coordinates in parent's coordinate system, or by specifying one
125  * of the predefined position flags (\c HorizontalPosition, \c VerticalPosition).
126  */
127 
130 
131  init();
132 }
133 
135  : AbstractAspect(name, AspectType::DatapickerPoint), d_ptr(dd) {
136 
137  init();
138 }
139 
140 //no need to delete the d-pointer here - it inherits from QGraphicsItem
141 //and is deleted during the cleanup in QGraphicsScene
143 
145  Q_D(DatapickerPoint);
146 
147  KConfig config;
148  KConfigGroup group;
149  group = config.group("DatapickerPoint");
150  d->position.setX( group.readEntry("PositionXValue", Worksheet::convertToSceneUnits(1, Worksheet::Unit::Centimeter)) );
151  d->position.setY( group.readEntry("PositionYValue", Worksheet::convertToSceneUnits(1, Worksheet::Unit::Centimeter)) );
152  d->plusDeltaXPos = group.readEntry("PlusDeltaXPos", QPointF(30, 0));
153  d->minusDeltaXPos = group.readEntry("MinusDeltaXPos", QPointF(-30, 0));
154  d->plusDeltaYPos = group.readEntry("PlusDeltaYPos", QPointF(0, -30));
155  d->minusDeltaYPos = group.readEntry("MinusDeltaYPos", QPointF(0, 30));
156 }
157 
159  m_errorBarItemList.clear();
160  if (errors.x != DatapickerCurve::ErrorType::NoError) {
161  auto* plusDeltaXItem = new ErrorBarItem(this, ErrorBarItem::ErrorBarType::PlusDeltaX);
162  plusDeltaXItem->setPosition(plusDeltaXPos());
163  connect(this, &DatapickerPoint::plusDeltaXPosChanged, plusDeltaXItem, &ErrorBarItem::setPosition);
164 
165  auto* minusDeltaXItem = new ErrorBarItem(this, ErrorBarItem::ErrorBarType::MinusDeltaX);
166  minusDeltaXItem->setPosition(minusDeltaXPos());
167  connect(this, &DatapickerPoint::minusDeltaXPosChanged, minusDeltaXItem, &ErrorBarItem::setPosition);
168 
169  m_errorBarItemList<<plusDeltaXItem<<minusDeltaXItem;
170  }
171 
172  if (errors.y != DatapickerCurve::ErrorType::NoError) {
173  auto* plusDeltaYItem = new ErrorBarItem(this, ErrorBarItem::ErrorBarType::PlusDeltaY);
174  plusDeltaYItem->setPosition(plusDeltaYPos());
175  connect(this, &DatapickerPoint::plusDeltaYPosChanged, plusDeltaYItem, &ErrorBarItem::setPosition);
176 
177  auto* minusDeltaYItem = new ErrorBarItem(this, ErrorBarItem::ErrorBarType::MinusDeltaY);
178  minusDeltaYItem->setPosition(minusDeltaYPos());
179  connect(this, &DatapickerPoint::minusDeltaYPosChanged, minusDeltaYItem, &ErrorBarItem::setPosition);
180 
181  m_errorBarItemList<<plusDeltaYItem<<minusDeltaYItem;
182  }
183 
184  retransform();
185 }
186 
187 /*!
188  Returns an icon to be used in the project explorer.
189 */
190 QIcon DatapickerPoint::icon() const {
191  return QIcon::fromTheme("draw-cross");
192 }
193 
195  QMenu* menu = AbstractAspect::createContextMenu();
196  return menu;
197 }
198 
199 QGraphicsItem* DatapickerPoint::graphicsItem() const {
200  return d_ptr;
201 }
202 
203 void DatapickerPoint::setParentGraphicsItem(QGraphicsItem* item) {
204  Q_D(DatapickerPoint);
205  d->setParentItem(item);
206 }
207 
209  Q_D(DatapickerPoint);
210  d->retransform();
211 }
212 
213 /* ============================ getter methods ================= */
214 //point
215 CLASS_SHARED_D_READER_IMPL(DatapickerPoint, QPointF, position, position)
216 //error-bar
217 CLASS_SHARED_D_READER_IMPL(DatapickerPoint, QPointF, plusDeltaXPos, plusDeltaXPos)
218 CLASS_SHARED_D_READER_IMPL(DatapickerPoint, QPointF, minusDeltaXPos, minusDeltaXPos)
219 CLASS_SHARED_D_READER_IMPL(DatapickerPoint, QPointF, plusDeltaYPos, plusDeltaYPos)
220 CLASS_SHARED_D_READER_IMPL(DatapickerPoint, QPointF, minusDeltaYPos, minusDeltaYPos)
221 
222 /* ============================ setter methods and undo commands ================= */
223 STD_SETTER_CMD_IMPL_F_S(DatapickerPoint, SetPosition, QPointF, position, retransform)
224 void DatapickerPoint::setPosition(QPointF pos) {
225  Q_D(DatapickerPoint);
226  if (pos != d->position)
227  exec(new DatapickerPointSetPositionCmd(d, pos, ki18n("%1: set position")));
228 }
229 
230 STD_SETTER_CMD_IMPL_F_S(DatapickerPoint, SetPlusDeltaXPos, QPointF, plusDeltaXPos, updatePoint)
231 void DatapickerPoint::setPlusDeltaXPos(QPointF pos) {
232  Q_D(DatapickerPoint);
233  if (pos != d->plusDeltaXPos) {
234  auto* curve = dynamic_cast<DatapickerCurve*>(parentAspect());
235  if (!curve)
236  return;
237 
238  beginMacro(i18n("%1: set +delta_X position", name()));
239  if (curve->curveErrorTypes().x == DatapickerCurve::ErrorType::SymmetricError) {
240  exec(new DatapickerPointSetPlusDeltaXPosCmd(d, pos, ki18n("%1: set +delta X position")));
241  setMinusDeltaXPos(QPointF(-qAbs(pos.x()), pos.y()));
242  } else
243  exec(new DatapickerPointSetPlusDeltaXPosCmd(d, pos, ki18n("%1: set +delta X position")));
244  endMacro();
245  }
246 }
247 
248 STD_SETTER_CMD_IMPL_F_S(DatapickerPoint, SetMinusDeltaXPos, QPointF, minusDeltaXPos, updatePoint)
249 void DatapickerPoint::setMinusDeltaXPos(QPointF pos) {
250  Q_D(DatapickerPoint);
251  if (pos != d->minusDeltaXPos) {
252  auto* curve = dynamic_cast<DatapickerCurve*>(parentAspect());
253  if (!curve)
254  return;
255 
256  beginMacro(i18n("%1: set -delta_X position", name()));
257  if (curve->curveErrorTypes().x == DatapickerCurve::ErrorType::SymmetricError) {
258  exec(new DatapickerPointSetMinusDeltaXPosCmd(d, pos, ki18n("%1: set -delta_X position")));
259  setPlusDeltaXPos(QPointF(qAbs(pos.x()), pos.y()));
260  } else
261  exec(new DatapickerPointSetMinusDeltaXPosCmd(d, pos, ki18n("%1: set -delta_X position")));
262  endMacro();
263  }
264 }
265 
266 STD_SETTER_CMD_IMPL_F_S(DatapickerPoint, SetPlusDeltaYPos, QPointF, plusDeltaYPos, updatePoint)
267 void DatapickerPoint::setPlusDeltaYPos(QPointF pos) {
268  Q_D(DatapickerPoint);
269  if (pos != d->plusDeltaYPos) {
270  auto* curve = dynamic_cast<DatapickerCurve*>(parentAspect());
271  if (!curve)
272  return;
273 
274  beginMacro(i18n("%1: set +delta_Y position", name()));
275  if (curve->curveErrorTypes().y == DatapickerCurve::ErrorType::SymmetricError) {
276  exec(new DatapickerPointSetPlusDeltaYPosCmd(d, pos, ki18n("%1: set +delta_Y position")));
277  setMinusDeltaYPos(QPointF(pos.x(), qAbs(pos.y())));
278  } else
279  exec(new DatapickerPointSetPlusDeltaYPosCmd(d, pos, ki18n("%1: set +delta_Y position")));
280  endMacro();
281  }
282 }
283 
284 STD_SETTER_CMD_IMPL_F_S(DatapickerPoint, SetMinusDeltaYPos, QPointF, minusDeltaYPos, updatePoint)
285 void DatapickerPoint::setMinusDeltaYPos(QPointF pos) {
286  Q_D(DatapickerPoint);
287  if (pos != d->minusDeltaYPos) {
288  auto* curve = dynamic_cast<DatapickerCurve*>(parentAspect());
289  if (!curve)
290  return;
291 
292  beginMacro(i18n("%1: set -delta_Y position", name()));
293  if (curve->curveErrorTypes().y == DatapickerCurve::ErrorType::SymmetricError) {
294  exec(new DatapickerPointSetMinusDeltaYPosCmd(d, pos, ki18n("%1: set -delta_Y position")));
295  setPlusDeltaYPos(QPointF(pos.x(), -qAbs(pos.y())));
296  } else
297  exec(new DatapickerPointSetMinusDeltaYPosCmd(d, pos, ki18n("%1: set -delta_Y position")));
298  endMacro();
299  }
300 }
301 
303  Q_D(DatapickerPoint);
304  d->m_printing = on;
305 }
306 
307 //##############################################################################
308 //####################### Private implementation ###############################
309 //##############################################################################
311  setFlag(QGraphicsItem::ItemIsMovable);
312  setFlag(QGraphicsItem::ItemSendsGeometryChanges);
313  setFlag(QGraphicsItem::ItemIsSelectable);
314  setAcceptHoverEvents(true);
315 }
316 
318  return q->name();
319 }
320 
321 /*!
322  calculates the position and the bounding box of the item/point. Called on geometry or properties changes.
323  */
325  updatePropeties();
326  setPos(position);
327  QPainterPath path = Symbol::pathFromStyle(pointStyle);
328  boundingRectangle = path.boundingRect();
331  updatePoint();
332 }
333 
334 /*!
335  update color and size of all error-bar.
336 */
338  for (auto* item : q->m_errorBarItemList) {
339  if (item) {
340  item->setBrush(errorBarBrush);
341  item->setPen(errorBarPen);
342  item->setRectSize(errorBarSize);
343  }
344  }
345 }
346 
347 /*!
348  update datasheet on any change in position of Datapicker-Point or it's error-bar.
349 */
351  auto* curve = dynamic_cast<DatapickerCurve*>(q->parentAspect());
352  if (curve)
353  curve->updatePoint(q);
354 }
355 
357  auto* curve = dynamic_cast<DatapickerCurve*>(q->parentAspect());
358  auto* image = dynamic_cast<DatapickerImage*>(q->parentAspect());
359  if (image) {
360  rotationAngle = image->pointRotationAngle();
361  pointStyle = image->pointStyle();
362  brush = image->pointBrush();
363  pen = image->pointPen();
364  opacity = image->pointOpacity();
365  size = image->pointSize();
366  setVisible(image->pointVisibility());
367  } else if (curve) {
368  rotationAngle = curve->pointRotationAngle();
369  pointStyle = curve->pointStyle();
370  brush = curve->pointBrush();
371  pen = curve->pointPen();
372  opacity = curve->pointOpacity();
373  size = curve->pointSize();
374  errorBarBrush = curve->pointErrorBarBrush();
375  errorBarPen = curve->pointErrorBarPen();
376  errorBarSize = curve->pointErrorBarSize();
377  setVisible(curve->pointVisibility());
378  }
379 }
380 
381 /*!
382  Returns the outer bounds of the item as a rectangle.
383  */
386 }
387 
388 /*!
389  Returns the shape of this item as a QPainterPath in local coordinates.
390 */
391 QPainterPath DatapickerPointPrivate::shape() const {
392  return itemShape;
393 }
394 
395 /*!
396  recalculates the outer bounds and the shape of the item.
397 */
399  prepareGeometryChange();
400 
401  QMatrix matrix;
402  matrix.scale(size, size);
403  matrix.rotate(-rotationAngle);
405  itemShape = QPainterPath();
408 }
409 
410 void DatapickerPointPrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) {
411  q->setPosition(pos());
412  QGraphicsItem::mouseReleaseEvent(event);
413 }
414 
415 void DatapickerPointPrivate::hoverEnterEvent(QGraphicsSceneHoverEvent*) {
416  setCursor(Qt::ArrowCursor);
417 }
418 
419 void DatapickerPointPrivate::hoverLeaveEvent(QGraphicsSceneHoverEvent*) {
420  setCursor(Qt::CrossCursor);
421 }
422 
423 void DatapickerPointPrivate::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
424  Q_UNUSED(option)
425  Q_UNUSED(widget)
426 
427  QPainterPath path = Symbol::pathFromStyle(pointStyle);
428  QTransform trafo;
429  trafo.scale(size, size);
430  path = trafo.map(path);
431  trafo.reset();
432  if (rotationAngle != 0) {
433  trafo.rotate(-rotationAngle);
434  path = trafo.map(path);
435  }
436  painter->save();
437  painter->setPen(pen);
438  painter->setBrush(brush);
439  painter->setOpacity(opacity);
440  painter->drawPath(path);
441  painter->restore();
442 
443  if (isSelected() && !m_printing) {
444  //TODO: move the initialization of QPen to a parent class later so we don't
445  //need to create it in every paint() call.
446  painter->setPen(QPen(QApplication::palette().color(QPalette::Highlight), 1, Qt::SolidLine));
447  painter->drawPath(itemShape);
448  }
449 }
450 
451 void DatapickerPointPrivate::contextMenuEvent(QGraphicsSceneContextMenuEvent* event) {
452  q->createContextMenu()->exec(event->screenPos());
453 }
454 
455 //##############################################################################
456 //################## Serialization/Deserialization ###########################
457 //##############################################################################
458 //! Save as XML
459 void DatapickerPoint::save(QXmlStreamWriter* writer) const {
460  Q_D(const DatapickerPoint);
461 
462  writer->writeStartElement( "datapickerPoint" );
463  writeBasicAttributes(writer);
464 
465  //geometry
466  writer->writeStartElement( "geometry" );
467  writer->writeAttribute( "x", QString::number(d->position.x()) );
468  writer->writeAttribute( "y", QString::number(d->position.y()) );
469  writer->writeEndElement();
470 
471  auto* curve = dynamic_cast<DatapickerCurve*>(parentAspect());
472  if (curve && (curve->curveErrorTypes().x != DatapickerCurve::ErrorType::NoError
473  || curve->curveErrorTypes().y != DatapickerCurve::ErrorType::NoError)) {
474 
475  writer->writeStartElement( "errorBar" );
476  writer->writeAttribute( "plusDeltaXPos_x", QString::number(d->plusDeltaXPos.x()) );
477  writer->writeAttribute( "plusDeltaXPos_y", QString::number(d->plusDeltaXPos.y()) );
478  writer->writeAttribute( "minusDeltaXPos_x", QString::number(d->minusDeltaXPos.x()) );
479  writer->writeAttribute( "minusDeltaXPos_y", QString::number(d->minusDeltaXPos.y()) );
480  writer->writeAttribute( "plusDeltaYPos_x", QString::number(d->plusDeltaYPos.x()) );
481  writer->writeAttribute( "plusDeltaYPos_y", QString::number(d->plusDeltaYPos.y()) );
482  writer->writeAttribute( "minusDeltaYPos_x", QString::number(d->minusDeltaYPos.x()) );
483  writer->writeAttribute( "minusDeltaYPos_y", QString::number(d->minusDeltaYPos.y()) );
484  writer->writeEndElement();
485  }
486 
487  writer->writeEndElement(); // close "DatapickerPoint" section
488 }
489 
490 //! Load from XML
491 bool DatapickerPoint::load(XmlStreamReader* reader, bool preview) {
492  Q_D(DatapickerPoint);
493 
494  if (!readBasicAttributes(reader))
495  return false;
496 
497  KLocalizedString attributeWarning = ki18n("Attribute '%1' missing or empty, default value is used");
498  QXmlStreamAttributes attribs;
499  QString str;
500 
501  while (!reader->atEnd()) {
502  reader->readNext();
503  if (reader->isEndElement() && reader->name() == "datapickerPoint")
504  break;
505 
506  if (!reader->isStartElement())
507  continue;
508 
509  if (!preview && reader->name() == "geometry") {
510  attribs = reader->attributes();
511 
512  str = attribs.value("x").toString();
513  if (str.isEmpty())
514  reader->raiseWarning(attributeWarning.subs("x").toString());
515  else
516  d->position.setX(str.toDouble());
517 
518  str = attribs.value("y").toString();
519  if (str.isEmpty())
520  reader->raiseWarning(attributeWarning.subs("y").toString());
521  else
522  d->position.setY(str.toDouble());
523  } else if (!preview && reader->name() == "errorBar") {
524  attribs = reader->attributes();
525 
526  str = attribs.value("plusDeltaXPos_x").toString();
527  if (str.isEmpty())
528  reader->raiseWarning(attributeWarning.subs("plusDeltaXPos_x").toString());
529  else
530  d->plusDeltaXPos.setX(str.toDouble());
531 
532  str = attribs.value("plusDeltaXPos_y").toString();
533  if (str.isEmpty())
534  reader->raiseWarning(attributeWarning.subs("plusDeltaXPos_y").toString());
535  else
536  d->plusDeltaXPos.setY(str.toDouble());
537 
538  str = attribs.value("minusDeltaXPos_x").toString();
539  if (str.isEmpty())
540  reader->raiseWarning(attributeWarning.subs("minusDeltaXPos_x").toString());
541  else
542  d->minusDeltaXPos.setX(str.toDouble());
543 
544  str = attribs.value("minusDeltaXPos_y").toString();
545  if (str.isEmpty())
546  reader->raiseWarning(attributeWarning.subs("minusDeltaXPos_y").toString());
547  else
548  d->minusDeltaXPos.setY(str.toDouble());
549 
550  str = attribs.value("plusDeltaYPos_x").toString();
551  if (str.isEmpty())
552  reader->raiseWarning(attributeWarning.subs("plusDeltaYPos_x").toString());
553  else
554  d->plusDeltaYPos.setX(str.toDouble());
555 
556  str = attribs.value("plusDeltaYPos_y").toString();
557  if (str.isEmpty())
558  reader->raiseWarning(attributeWarning.subs("plusDeltaYPos_y").toString());
559  else
560  d->plusDeltaYPos.setY(str.toDouble());
561 
562  str = attribs.value("minusDeltaYPos_x").toString();
563  if (str.isEmpty())
564  reader->raiseWarning(attributeWarning.subs("minusDeltaYPos_x").toString());
565  else
566  d->minusDeltaYPos.setX(str.toDouble());
567 
568  str = attribs.value("minusDeltaYPos_y").toString();
569  if (str.isEmpty())
570  reader->raiseWarning(attributeWarning.subs("minusDeltaYPos_y").toString());
571  else
572  d->minusDeltaYPos.setY(str.toDouble());
573  } else { // unknown element
574  reader->raiseWarning(i18n("unknown element '%1'", reader->name().toString()));
575  if (!reader->skipToEndElement()) return false;
576  }
577  }
578 
579  retransform();
580  return true;
581 }
AspectType
Base class of all persistent objects in a Project.
QString name() const
virtual QMenu * createContextMenu()
Return a new context menu.
void writeBasicAttributes(QXmlStreamWriter *) const
Save name and creation time to XML.
AbstractAspect * parentAspect() const
Return my parent Aspect or 0 if I currently don't have one.
void beginMacro(const QString &text)
Begin an undo stack macro (series of commands)
void exec(QUndoCommand *)
Execute the given command, pushing it on the undoStack() if available.
bool readBasicAttributes(XmlStreamReader *)
Load name and creation time from XML.
AbstractAspectPrivate * d
void endMacro()
End the current undo stack macro.
Top-level container for Curve-Point and Datasheet/Spreadsheet of datapicker.
void updatePoint(const DatapickerPoint *)
container to open image/plot.
void contextMenuEvent(QGraphicsSceneContextMenuEvent *) override
void hoverLeaveEvent(QGraphicsSceneHoverEvent *) override
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *widget=nullptr) override
void hoverEnterEvent(QGraphicsSceneHoverEvent *) override
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override
DatapickerPoint *const q
virtual void recalcShapeAndBoundingRect()
QRectF boundingRect() const override
DatapickerPointPrivate(DatapickerPoint *)
QPainterPath shape() const override
~DatapickerPoint() override
void minusDeltaXPosChanged(QPointF)
void initErrorBar(DatapickerCurve::Errors)
void setPrinting(bool)
DatapickerPointPrivate *const d_ptr
QList< ErrorBarItem * > m_errorBarItemList
QIcon icon() const override
void minusDeltaYPosChanged(QPointF)
void plusDeltaXPosChanged(QPointF)
void save(QXmlStreamWriter *) const override
Save as XML.
bool load(XmlStreamReader *, bool preview) override
Load from XML.
void plusDeltaYPosChanged(QPointF)
QMenu * createContextMenu() override
Return a new context menu.
QGraphicsItem * graphicsItem() const
DatapickerPoint(const QString &name)
void setParentGraphicsItem(QGraphicsItem *)
A customizable error-bar for DatapickerPoint.
ErrorBarType m_type
QVariant itemChange(GraphicsItemChange, const QVariant &value) override
void hoverEnterEvent(QGraphicsSceneHoverEvent *) override
QGraphicsLineItem * barLineItem
void setPosition(QPointF)
DatapickerPoint * m_parentItem
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override
ErrorBarItem(DatapickerPoint *parent=nullptr, ErrorBarType type=ErrorBarType::PlusDeltaX)
void setRectSize(const qreal)
static QPainterPath pathFromStyle(Symbol::Style)
Definition: Symbol.cpp:43
static QPainterPath shapeFromPath(const QPainterPath &, const QPen &)
static double convertToSceneUnits(const double value, const Worksheet::Unit unit)
Definition: Worksheet.cpp:113
XML stream parser that supports errors as well as warnings. This class also adds line and column numb...
void raiseWarning(const QString &)
#define CLASS_SHARED_D_READER_IMPL(classname, type, method, var)
Definition: macros.h:154
#define STD_SETTER_CMD_IMPL_F_S(class_name, cmd_name, value_type, field_name, finalize_method)
Definition: macros.h:215
#define i18n(m)
Definition: nsl_common.h:38