1 /* 2 * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 3 * 4 * This file is part of the KD Chart library. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef KCHARTABSTRACTDIAGRAM_H 21 #define KCHARTABSTRACTDIAGRAM_H 22 23 #include <QList> 24 #include <QRectF> 25 #include <QAbstractItemView> 26 27 #include "KChartGlobal.h" 28 #include "KChartMarkerAttributes.h" 29 #include "KChartAttributesModel.h" 30 31 namespace KChart { 32 33 class AbstractCoordinatePlane; 34 class AttributesModel; 35 class DataValueAttributes; 36 class PaintContext; 37 38 /** 39 * @brief AbstractDiagram defines the interface for diagram classes 40 * 41 * AbstractDiagram is the base class for diagram classes ("chart types"). 42 * 43 * It defines the interface, that needs to be implemented for the diagram, 44 * to function within the KChart framework. It extends Interview's 45 * QAbstractItemView. 46 */ 47 class KCHART_EXPORT AbstractDiagram : public QAbstractItemView 48 { 49 Q_OBJECT 50 Q_DISABLE_COPY( AbstractDiagram ) 51 KCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( AbstractDiagram ) 52 53 friend class AbstractCoordinatePlane; 54 friend class CartesianCoordinatePlane; 55 friend class PolarCoordinatePlane; 56 57 protected: 58 explicit inline AbstractDiagram( 59 Private *p, QWidget* parent, AbstractCoordinatePlane* plane ); 60 explicit AbstractDiagram ( 61 QWidget* parent = nullptr, AbstractCoordinatePlane* plane = nullptr ); 62 public: 63 virtual ~AbstractDiagram(); 64 65 66 /** 67 * Returns true if both diagrams have the same settings. 68 */ 69 bool compare( const AbstractDiagram* other ) const; 70 71 72 /** 73 * @brief Return the bottom left and top right data point, that the 74 * diagram will display (unless the grid adjusts these values). 75 * 76 * This method returns a cached result of calculations done by 77 * calculateDataBoundaries. 78 * Classes derived from AbstractDiagram must implement the 79 * calculateDataBoundaries function, to specify their own 80 * way of calculating the data boundaries. 81 * If derived classes want to force recalculation of the 82 * data boundaries, they can call setDataBoundariesDirty() 83 * 84 * Returned value is in diagram coordinates. 85 */ 86 const QPair<QPointF, QPointF> dataBoundaries() const; 87 88 // protected: // FIXME: why should that be private? (Mirko) 89 /** 90 * Draw the diagram contents to the rectangle and painter, that are 91 * passed in as part of the paint context. 92 * 93 * @param paintContext All information needed for painting. 94 */ 95 virtual void paint ( PaintContext* paintContext ) = 0; 96 97 /** 98 * Called by the widget's sizeEvent. Adjust all internal structures, 99 * that are calculated, dependending on the size of the widget. 100 * 101 * @param area 102 */ 103 virtual void resize ( const QSizeF& area ); 104 105 /** Associate a model with the diagram. */ 106 void setModel ( QAbstractItemModel * model ) override; 107 108 /** Associate a seleection model with the diagrom. */ 109 void setSelectionModel( QItemSelectionModel* selectionModel ) override; 110 111 /** 112 * Associate an AttributesModel with this diagram. Note that 113 * the diagram does _not_ take ownership of the AttributesModel. 114 * This should thus only be used with AttributesModels that 115 * have been explicitly created by the user, and are owned 116 * by her. Setting an AttributesModel that is internal to 117 * another diagram is an error. 118 * 119 * Correct: 120 * 121 * \code 122 * AttributesModel *am = new AttributesModel( model, 0 ); 123 * diagram1->setAttributesModel( am ); 124 * diagram2->setAttributesModel( am ); 125 * 126 * \endcode 127 * 128 * Wrong: 129 * 130 * \code 131 * 132 * diagram1->setAttributesModel( diagram2->attributesModel() ); 133 * 134 * \endcode 135 * 136 * @param model The AttributesModel to use for this diagram. 137 * @see AttributesModel, usesExternalAttributesModel 138 */ 139 virtual void setAttributesModel( AttributesModel* model ); 140 141 /** 142 * Returns whether the diagram is using its own built-in attributes model 143 * or an attributes model that was set via setAttributesModel. 144 * 145 * @see setAttributesModel 146 */ 147 virtual bool usesExternalAttributesModel() const; 148 149 /** 150 * Returns the AttributesModel, that is used by this diagram. 151 * By default each diagram owns its own AttributesModel, which 152 * should never be deleted. Only if a user-supplied AttributesModel 153 * has been set does the pointer returned here not belong to the 154 * diagram. 155 * 156 * @return The AttributesModel associated with the diagram. 157 * @see setAttributesModel 158 */ 159 virtual AttributesModel* attributesModel() const; 160 161 /** Set the root index in the model, where the diagram starts 162 * referencing data for display. */ 163 void setRootIndex ( const QModelIndex& idx ) override; 164 165 /** \reimpl */ 166 QRect visualRect(const QModelIndex &index) const override; 167 /** \reimpl */ 168 void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override; 169 /** \reimpl */ 170 QModelIndex indexAt(const QPoint &point) const override; 171 /** \reimpl */ 172 QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override; 173 /** \reimpl */ 174 int horizontalOffset() const override; 175 /** \reimpl */ 176 int verticalOffset() const override; 177 /** \reimpl */ 178 bool isIndexHidden(const QModelIndex &index) const override; 179 /** \reimpl */ 180 void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override; 181 /** \reimpl */ 182 QRegion visualRegionForSelection(const QItemSelection &selection) const override; 183 virtual QRegion visualRegion(const QModelIndex &index) const; 184 /** \reimpl */ 185 void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override; 186 /** \reimpl */ 187 void doItemsLayout() override; 188 189 /** 190 * The coordinate plane associated with the diagram. This determines 191 * how coordinates in value space are mapped into pixel space. By default 192 * this is a CartesianCoordinatePlane. 193 * @return The coordinate plane associated with the diagram. 194 */ 195 AbstractCoordinatePlane* coordinatePlane() const; 196 197 /** 198 * Set the coordinate plane associated with the diagram. This determines 199 * how coordinates in value space are mapped into pixel space. The chart 200 * takes ownership. 201 */ 202 virtual void setCoordinatePlane( AbstractCoordinatePlane* plane ); 203 204 205 /** 206 * Hide (or unhide, resp.) a data cell. 207 * 208 * \note Hidden data are still taken into account by the coordinate plane, 209 * so neither the grid nor your axes' ranges will change, when you hide data. 210 * For totally removing data from KChart's view you can use another approach: 211 * e.g. you could define a proxy model on top of your data model, and register 212 * the proxy model calling setModel() instead of registering your real data model. 213 * 214 * @param index The datapoint to set the hidden status for. With a dataset dimension 215 * of two, this is the index of the key of each key/value pair. 216 * @param hidden The hidden status to set. 217 */ 218 void setHidden( const QModelIndex & index, bool hidden ); 219 220 /** 221 * Hide (or unhide, resp.) a dataset. 222 * 223 * \note Hidden data are still taken into account by the coordinate plane, 224 * so neither the grid nor your axes' ranges will change, when you hide data. 225 * For totally removing data from KChart's view you can use another approach: 226 * e.g. you could define a proxy model on top of your data model, and register 227 * the proxy model calling setModel() instead of registering your real data model. 228 * 229 * @param dataset The dataset to set the hidden status for. 230 * @param hidden The hidden status to set. 231 */ 232 void setHidden( int dataset, bool hidden ); 233 234 /** 235 * Hide (or unhide, resp.) all datapoints in the model. 236 * 237 * \note Hidden data are still taken into account by the coordinate plane, 238 * so neither the grid nor your axes' ranges will change, when you hide data. 239 * For totally removing data from KChart's view you can use another approach: 240 * e.g. you could define a proxy model on top of your data model, and register 241 * the proxy model calling setModel() instead of registering your real data model. 242 * 243 * @param hidden The hidden status to set. 244 */ 245 void setHidden( bool hidden ); 246 247 /** 248 * Retrieve the hidden status specified globally. This will fall 249 * back automatically to the default settings ( = not hidden), if there 250 * are no specific settings. 251 * @return The global hidden status. 252 */ 253 bool isHidden() const; 254 255 /** 256 * Retrieve the hidden status for the given dataset. This will fall 257 * back automatically to what was set at diagram level, if there 258 * are no dataset specific settings. 259 * @param dataset The dataset to retrieve the hidden status for. 260 * @return The hidden status for the given dataset. 261 */ 262 bool isHidden( int dataset ) const; 263 264 /** 265 * Retrieve the hidden status for the given index. This will fall 266 * back automatically to what was set at dataset or diagram level, if there 267 * are no datapoint specific settings. 268 * @param index The datapoint to retrieve the hidden status for. 269 * @return The hidden status for the given index. 270 */ 271 bool isHidden( const QModelIndex & index ) const; 272 273 274 /** 275 * Set the DataValueAttributes for the given index. 276 * @param index The datapoint to set the attributes for. With a dataset dimension 277 * of two, this is the index of the key of each key/value pair. 278 * @param a The attributes to set. 279 */ 280 void setDataValueAttributes( const QModelIndex & index, 281 const DataValueAttributes & a ); 282 283 /** 284 * Set the DataValueAttributes for the given dataset. 285 * @param dataset The dataset to set the attributes for. 286 * @param a The attributes to set. 287 */ 288 void setDataValueAttributes( int dataset, const DataValueAttributes & a ); 289 290 /** 291 * Set the DataValueAttributes for all datapoints in the model. 292 * @param a The attributes to set. 293 */ 294 void setDataValueAttributes( const DataValueAttributes & a ); 295 296 /** 297 * Retrieve the DataValueAttributes specified globally. This will fall 298 * back automatically to the default settings, if there 299 * are no specific settings. 300 * @return The global DataValueAttributes. 301 */ 302 DataValueAttributes dataValueAttributes() const; 303 304 /** 305 * Retrieve the DataValueAttributes for the given dataset. This will fall 306 * back automatically to what was set at model level, if there 307 * are no dataset specific settings. 308 * @param dataset The dataset to retrieve the attributes for. 309 * @return The DataValueAttributes for the given dataset. 310 */ 311 DataValueAttributes dataValueAttributes( int dataset ) const; 312 313 /** 314 * Retrieve the DataValueAttributes for the given index. This will fall 315 * back automatically to what was set at dataset or model level, if there 316 * are no datapoint specific settings. 317 * @param index The datapoint to retrieve the attributes for. With a dataset dimension 318 * of two, this is the index of the key of each key/value pair. 319 * @return The DataValueAttributes for the given index. 320 */ 321 DataValueAttributes dataValueAttributes( const QModelIndex & index ) const; 322 323 /** 324 * Set the pen to be used, for painting the datapoint at the given index. 325 * @param index The datapoint's index in the model. With a dataset dimension 326 * of two, this is the index of the key of each key/value pair. 327 * @param pen The pen to use. 328 */ 329 void setPen( const QModelIndex& index, const QPen& pen ); 330 331 /** 332 * Set the pen to be used, for painting the given dataset. 333 * @param dataset The dataset to set the pen for. 334 * @param pen The pen to use. 335 */ 336 void setPen( int dataset, const QPen& pen ); 337 338 /** 339 * Set the pen to be used, for painting all datasets in the model. 340 * @param pen The pen to use. 341 */ 342 void setPen( const QPen& pen ); 343 344 /** 345 * Retrieve the pen to be used for painting datapoints globally. This will fall 346 * back automatically to the default settings, if there 347 * are no specific settings. 348 * @return The pen to use for painting. 349 */ 350 QPen pen() const; 351 /** 352 * Retrieve the pen to be used for the given dataset. This will fall 353 * back automatically to what was set at model level, if there 354 * are no dataset specific settings. 355 * @param dataset The dataset to retrieve the pen for. 356 * @return The pen to use for painting. 357 */ 358 QPen pen( int dataset ) const; 359 /** 360 * Retrieve the pen to be used, for painting the datapoint at the given 361 * index in the model. 362 * @param index The index of the datapoint in the model. With a dataset dimension 363 * of two, this is the index of the key of each key/value pair. 364 * @return The pen to use for painting. 365 */ 366 QPen pen( const QModelIndex& index ) const; 367 368 /** 369 * Set the brush to be used, for painting the datapoint at the given index. 370 * @param index The datapoint's index in the model. With a dataset dimension 371 * of two, this is the index of the key of each key/value pair. 372 * @param brush The brush to use. 373 */ 374 void setBrush( const QModelIndex& index, const QBrush& brush); 375 376 /** 377 * Set the brush to be used, for painting the given dataset. 378 * @param dataset The dataset to set the brush for. 379 * @param brush The brush to use. 380 */ 381 void setBrush( int dataset, const QBrush& brush ); 382 383 /** 384 * Set the brush to be used, for painting all datasets in the model. 385 * @param brush The brush to use. 386 */ 387 void setBrush( const QBrush& brush); 388 389 /** 390 * Retrieve the brush to be used for painting datapoints globally. This will fall 391 * back automatically to the default settings, if there 392 * are no specific settings. 393 * @return The brush to use for painting. 394 */ 395 QBrush brush() const; 396 /** 397 * Retrieve the brush to be used for the given dataset. This will fall 398 * back automatically to what was set at model level, if there 399 * are no dataset specific settings. 400 * @param dataset The dataset to retrieve the brush for. 401 * @return The brush to use for painting. 402 */ 403 QBrush brush( int dataset ) const; 404 /** 405 * Retrieve the brush to be used, for painting the datapoint at the given 406 * index in the model. 407 * @param index The index of the datapoint in the model. With a dataset dimension 408 * of two, this is the index of the key of each key/value pair. 409 * @return The brush to use for painting. 410 */ 411 QBrush brush( const QModelIndex& index ) const; 412 413 /** 414 * Set the unit prefix to be used on axes for one specific column. 415 * @param prefix The prefix to be used. 416 * @param column The column which should be set. 417 * @param orientation The orientation of the axis to use. 418 */ 419 void setUnitPrefix( const QString& prefix, int column, Qt::Orientation orientation ); 420 /** 421 * Set the unit prefix to be used on axes for all columns. 422 * @param prefix The prefix to be used. 423 * @param orientation The orientation of the axis to use. 424 */ 425 void setUnitPrefix( const QString& prefix, Qt::Orientation orientation ); 426 427 /** 428 * Set the unit prefix to be used on axes for one specific column. 429 * @param suffix The suffix to be used. 430 * @param column The column which should be set. 431 * @param orientation The orientation of the axis to use. 432 */ 433 void setUnitSuffix( const QString& suffix, int column, Qt::Orientation orientation ); 434 /** 435 * Set the unit prefix to be used on axes for all columns. 436 * @param suffix The suffix to be used. 437 * @param orientation The orientation of the axis to use. 438 */ 439 void setUnitSuffix( const QString& suffix, Qt::Orientation orientation ); 440 441 /** 442 * Retrieves the axis unit prefix for a specific column. 443 * @param column The column whose prefix should be retrieved. 444 * @param orientation The orientation of the axis. 445 * @param fallback If true, the prefix for all columns is returned, when 446 * none is set for the selected column. 447 * @return The axis unit prefix. 448 */ 449 QString unitPrefix( int column, Qt::Orientation orientation, bool fallback = false ) const; 450 /** 451 * Retrieves the axis unit prefix. 452 * @param orientation The orientation of the axis. 453 * @return The axis unit prefix. 454 */ 455 QString unitPrefix( Qt::Orientation orientation ) const; 456 457 /** 458 * Retrieves the axis unit suffix for a specific column. 459 * @param column The column whose prefix should be retrieved. 460 * @param orientation The orientation of the axis. 461 * @param fallback If true, the suffix for all columns is returned, when 462 * none is set for the selected column. 463 * @return The axis unit suffix. 464 */ 465 QString unitSuffix( int column, Qt::Orientation orientation, bool fallback = false ) const; 466 /** 467 * Retrieves the axis unit suffix. 468 * @param orientation The orientation of the axis. 469 * @return The axis unit suffix. 470 */ 471 QString unitSuffix( Qt::Orientation orientation ) const; 472 473 /** 474 * Set whether data value labels are allowed to overlap. 475 * @param allow True means that overlapping labels are allowed. 476 */ 477 void setAllowOverlappingDataValueTexts( bool allow ); 478 479 /** 480 * @return Whether data value labels are allowed to overlap. 481 */ 482 bool allowOverlappingDataValueTexts() const; 483 484 /** 485 * Set whether anti-aliasing is to be used while rendering 486 * this diagram. 487 * @param enabled True means that AA is enabled. 488 */ 489 void setAntiAliasing( bool enabled ); 490 491 /** 492 * @return Whether anti-aliasing is to be used for rendering 493 * this diagram. 494 */ 495 bool antiAliasing() const; 496 497 /** 498 * Set the palette to be used, for painting datasets to the default 499 * palette. 500 * @see KChart::Palette. 501 * FIXME: fold into one usePalette (KChart::Palette&) method 502 */ 503 void useDefaultColors(); 504 505 /** 506 * Set the palette to be used, for painting datasets to the rainbow 507 * palette. 508 * @see KChart::Palette. 509 */ 510 void useRainbowColors(); 511 512 /** 513 * Set the palette to be used, for painting datasets to the subdued 514 * palette. 515 * @see KChart::Palette. 516 */ 517 void useSubduedColors(); 518 519 /** 520 * The set of item row labels currently displayed, for use in Abscissa axes, etc. 521 * @return The set of item row labels currently displayed. 522 */ 523 QStringList itemRowLabels() const; 524 525 /** 526 * The set of dataset labels currently displayed, for use in legends, etc. 527 * @return The set of dataset labels currently displayed. 528 */ 529 QStringList datasetLabels() const; 530 531 /** 532 * The set of dataset brushes currently used, for use in legends, etc. 533 * 534 * @note Cell-level override brushes, if set, take precedence over the 535 * dataset values, so you might need to check these too, in order to find 536 * the brush, that is used for a single cell. 537 * 538 * @return The current set of dataset brushes. 539 */ 540 QList<QBrush> datasetBrushes() const; 541 542 /** 543 * The set of dataset pens currently used, for use in legends, etc. 544 * 545 * @note Cell-level override pens, if set, take precedence over the 546 * dataset values, so you might need to check these too, in order to find 547 * the pens, that is used for a single cell. 548 * 549 * @return The current set of dataset pens. 550 */ 551 QList<QPen> datasetPens() const; 552 553 /** 554 * The set of dataset markers currently used, for use in legends, etc. 555 * 556 * @note Cell-level override markers, if set, take precedence over the 557 * dataset values, so you might need to check these too, in order to find 558 * the marker, that is shown for a single cell. 559 * 560 * @return The current set of dataset brushes. 561 */ 562 QList<MarkerAttributes> datasetMarkers() const; 563 564 565 /** 566 * \deprecated 567 * 568 * \brief Deprecated method that turns the percent mode of this diagram on or off. 569 * 570 * This method is deprecated. Use the setType() method of a supporting diagram implementation 571 * instead, e.g. BarDiagram::setType(). 572 * 573 * \see percentMode 574 */ 575 void setPercentMode( bool percent ); 576 577 578 /** 579 * \brief Returns whether this diagram is drawn in percent mode. 580 * 581 * If true, all data points in the same column of a diagram will 582 * be be drawn at the same X coordinate and stacked up so that the distance from the 583 * last data point (or the zero line) to a data point P is always the ratio of (Y-Value of P)/ 584 * (sum of all Y-Values in same column as P) relative to the diagrams height 585 * (or width, if abscissa and ordinate are swapped). 586 * 587 * Note that this property is not applicable to all diagram types. 588 */ 589 bool percentMode() const; 590 591 virtual void paintMarker( QPainter* painter, 592 const MarkerAttributes& markerAttributes, 593 const QBrush& brush, const QPen&, 594 const QPointF& point, const QSizeF& size ); 595 596 /** 597 * The dataset dimension of a diagram determines how many value dimensions 598 * it expects each datapoint to have. 599 * For each dimension and data series it will expect one column of values in the model. 600 * If the dimension is 1, automatic values will be used for X. 601 * 602 * For example, a diagram with the default dimension of 1 will have one column 603 * per data series (the Y values) and will use automatic values for X 604 * (1, 2, 3, ... n). 605 * If the dimension is 2, the diagram will use the first, (and the third, 606 * fifth, etc) columns as X values, and the second, (and the fourth, sixth, 607 * etc) column as Y values. 608 * @return The dataset dimension of the diagram. 609 */ 610 int datasetDimension() const; 611 612 /** 613 * \deprecated 614 * 615 * Sets the dataset dimension of the diagram. Using this method 616 * is deprecated. Use the specific diagram types instead. 617 */ 618 void setDatasetDimension( int dimension ); 619 620 protected: 621 void setDatasetDimensionInternal( int dimension ); 622 623 public: 624 void update() const; 625 626 void paintMarker( QPainter* painter, const DataValueAttributes& a, 627 const QModelIndex& index, 628 const QPointF& pos ); 629 void paintMarker( QPainter* painter, 630 const QModelIndex& index, 631 const QPointF& pos ); 632 void paintDataValueText( QPainter* painter, const QModelIndex& index, 633 const QPointF& pos, qreal value ); 634 635 // reverse mapping: 636 /** This method is added alongside with indexAt from QAIM, 637 since in KChart multiple indexes can be displayed at the same 638 spot. */ 639 QModelIndexList indexesAt( const QPoint& point ) const; 640 QModelIndexList indexesIn( const QRect& rect ) const; 641 642 protected: 643 virtual bool checkInvariants( bool justReturnTheStatus=false ) const; 644 virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const = 0; 645 646 protected Q_SLOTS: 647 void setDataBoundariesDirty() const; 648 649 protected: 650 /** 651 * \deprecated 652 * This method is deprecated and provided for backward-compatibility only. 653 * Your own diagram classes should call 654 * d->paintDataValueTextsAndMarkers() instead 655 * which also is taking care for showing your cell-specific comments, if any, 656 */ 657 virtual void paintDataValueTexts( QPainter* painter ); 658 /** 659 * \deprecated 660 * This method is deprecated and provided for backward-compatibility only. 661 * Your own diagram classes should call 662 * d->paintDataValueTextsAndMarkers() instead 663 * which also is taking care for showing your cell-specific comments, if any, 664 */ 665 virtual void paintMarkers( QPainter* painter ); 666 667 /*! \internal */ 668 void setAttributesModelRootIndex( const QModelIndex& ); 669 670 /*! returns a QModelIndex pointing into the AttributesModel that corresponds to the 671 root index of the diagram. */ 672 QModelIndex attributesModelRootIndex() const; 673 674 /** 675 * Helper method, retrieving the data value (DisplayRole) for a given row and column 676 * @param row The row to query. 677 * @param column The column to query. 678 * @return The value of the display role at the given row and column as a qreal. 679 * @deprecated 680 */ 681 qreal valueForCell( int row, int column ) const; 682 683 Q_SIGNALS: 684 /** Diagrams are supposed to emit this signal, when the layout of one 685 of their element changes. Layouts can change, for example, when 686 axes are added or removed, or when the configuration was changed 687 in a way that the axes or the diagram itself are displayed in a 688 different geometry. 689 Changes in the diagrams coordinate system also result 690 in the layoutChanged() signal being emitted. 691 */ 692 void layoutChanged( AbstractDiagram* ); 693 694 /** 695 * This signal is emitted when this diagram is being destroyed, but before all the 696 * data, i.e. the attributes model, is invalidated. 697 */ 698 void aboutToBeDestroyed(); 699 700 /** This signal is emitted when either the model or the AttributesModel is replaced. */ 701 void modelsChanged(); 702 703 /** This signal is emitted just before the new attributes model is connected internally. 704 It gives you a chance to connect to its signals first or perform other setup work. */ 705 void attributesModelAboutToChange( AttributesModel* newModel, AttributesModel* oldModel ); 706 707 /** This signal is emitted, when the model data is changed. */ 708 void modelDataChanged(); 709 710 /** This signal is emitted, when the hidden status of at least one data cell was (un)set. */ 711 void dataHidden(); 712 713 /** Emitted upon change of a property of the Diagram. */ 714 void propertiesChanged(); 715 716 /** Emitted upon change of a data boundary */ 717 void boundariesChanged(); 718 /** Emitted upon change of the view coordinate system */ 719 void viewportCoordinateSystemChanged(); 720 721 private: 722 QModelIndex conditionallyMapFromSource( const QModelIndex & sourceIndex ) const; 723 }; 724 725 typedef QList<AbstractDiagram*> AbstractDiagramList; 726 typedef QList<const AbstractDiagram*> ConstAbstractDiagramList; 727 728 /** 729 * @brief Internally used class just adding a special constructor used by AbstractDiagram 730 */ 731 class PrivateAttributesModel : public AttributesModel { 732 Q_OBJECT 733 public: 734 explicit PrivateAttributesModel( QAbstractItemModel* model, QObject * parent = nullptr ) AttributesModel(model,parent)735 : AttributesModel(model,parent) {} 736 }; 737 } 738 739 #endif 740