KChart

KChartDiagramObserver.h
1 /*
2  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef __KCHARTDIAGRAMOBSERVER_H_
10 #define __KCHARTDIAGRAMOBSERVER_H_
11 
12 #include "KChartGlobal.h"
13 
14 #include <QObject>
15 #include <QPointer>
16 #include <QModelIndex>
17 
18 QT_BEGIN_NAMESPACE
19 class QAbstractItemModel;
20 QT_END_NAMESPACE
21 
22 namespace KChart {
23 
24  class AbstractDiagram;
25 
26  /**
27  * \brief A DiagramObserver watches the associated diagram for
28  * changes and deletion and emits corresponding signals.
29  */
30  class KCHART_EXPORT DiagramObserver : public QObject
31  {
32  Q_OBJECT
33  public:
34  /**
35  * Constructs a new observer observing the given diagram.
36  */
37  explicit DiagramObserver( AbstractDiagram * diagram, QObject* parent = nullptr );
38  ~DiagramObserver();
39 
40  const AbstractDiagram* diagram() const;
41  AbstractDiagram* diagram();
42 
43  Q_SIGNALS:
44  /** This signal is emitted immediately before the diagram is
45  * being destroyed. */
46  void diagramDestroyed( KChart::AbstractDiagram* diagram );
47  /** Emitted when a diagram is being destroyed, but before its data is invalidated **/
48  void diagramAboutToBeDestroyed( KChart::AbstractDiagram* diagram );
49  /** This signal is emitted whenever the data of the diagram changes. */
50  void diagramDataChanged( KChart::AbstractDiagram* diagram );
51  /** This signal is emitted whenever any of the data of the diagram was set (un)hidden. */
52  void diagramDataHidden( KChart::AbstractDiagram* diagram );
53  /** This signal is emitted whenever the attributes of the diagram change. */
54  void diagramAttributesChanged( KChart::AbstractDiagram* diagram );
55 
56  private Q_SLOTS:
57  void slotDestroyed(QObject*);
58  void slotAboutToBeDestroyed();
59  void slotHeaderDataChanged(Qt::Orientation,int,int);
60  void slotDataChanged(QModelIndex,QModelIndex);
61  void slotDataChanged();
62  void slotDataHidden();
63  void slotAttributesChanged();
64  void slotAttributesChanged(QModelIndex,QModelIndex);
65  void slotModelsChanged();
66 
67  private:
68  void init();
69 
70  AbstractDiagram* m_diagram;
72  QPointer<QAbstractItemModel> m_attributesmodel;
73  };
74 }
75 
76 #endif // KChartDiagramObserver_H
AbstractDiagram defines the interface for diagram classes.
Class only listed here to document inheritance of some KChart classes.
Contains KChart macros.
A DiagramObserver watches the associated diagram for changes and deletion and emits corresponding sig...
QCA_EXPORT void init()
Orientation
Global namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jul 28 2021 22:36:44 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.