GobChartsWidget  1.0
gobchartswidget.h
1 /* Copyright (C) 2012 by William Hallatt.
2  *
3  * This file forms part of the "GobChartsWidget" library.
4  *
5  * This library is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have downloaded a copy of the GNU General Public License
16  * (GNUGPL.txt) and GNU Lesser General Public License (GNULGPL.txt)
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * The official website for this project is www.goblincoding.com and,
20  * although not compulsory, it would be appreciated if all works of whatever
21  * nature referring to or using this library include a reference to this site.
22  */
23 
24 #ifndef GOBCHARTSWIDGET_H
25 #define GOBCHARTSWIDGET_H
26 
27 #include <QFrame>
28 #include "utils/gobchartswidgetdef.h"
29 #include "utils/globalincludes.h"
30 #include "utils/gobchartsnocopy.h"
31 
32 class QAbstractItemModel;
33 class QItemSelectionModel;
34 class QListWidgetItem;
35 
100 
101 
124 class GOBCHARTSWIDGETSHARED_EXPORT GobChartsWidget : public QFrame,
125  public GobChartsNoCopy
126 {
127  Q_OBJECT
128 
129 public:
131  explicit GobChartsWidget( QWidget *parent = 0 );
132 
134  ~GobChartsWidget();
135 
137  void setModel( QAbstractItemModel *model );
138 
140  void setSelectionModel( QItemSelectionModel *selectionModel );
141 
144  void setDebugLoggingOn( bool log );
145 
146 signals:
149  void lastDebugLogMsg( QString );
150 
151 private slots:
152  void graphicsItemSelected( const QString & legendText );
153  void legendItemSelected( QListWidgetItem *item );
154  void createLegendItem( const QColor &colour, const QString &text );
155  void clearLegend();
156 
157  void createChart( GobChartsType type );
158  void clearChart();
159  void saveChart();
160  void loadChart();
161 
162 private:
163  struct GobChartsWidgetPrivate;
164  GobChartsWidgetPrivate* const m_private;
165 };
166 
167 #endif // GOBCHARTSWIDGET_H