File indexing completed on 2024-05-12 15:53:54

0001 /**
0002  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB.  All rights reserved.
0003  *
0004  * This file is part of the KD Chart library.
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU General Public License as
0008  * published by the Free Software Foundation; either version 2 of
0009  * the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef MAINWINDOW_H
0021 #define MAINWINDOW_H
0022 
0023 #include "ui_mainwindow.h"
0024 #include <TableModel.h>
0025 
0026 #include <QPixmap>
0027 
0028 namespace KChart {
0029     class Chart;
0030     class DatasetProxyModel;
0031     class LineDiagram;
0032     class Legend;
0033 }
0034 
0035 class QLabel;
0036 
0037 class MainWindow : public QWidget, private Ui::MainWindow
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     MainWindow( QWidget* parent = nullptr );
0043     void updateData(QString data);
0044 
0045     protected:
0046         /**
0047          * Adjusts the two small charts when the window is resized.
0048          */
0049         /* reimp */ void resizeEvent ( QResizeEvent * ) override;
0050 
0051 private Q_SLOTS:
0052 
0053     void setLineType( const QString & text );
0054     void setLegendVisible( bool visible );
0055     void setValuesVisible( bool visible );
0056     void setMarkersVisible( bool visible );
0057     void updateMarkers();
0058     void updateMarkersHeight();
0059     void updateMarkersWidth();
0060     void updateAreas( bool visible );
0061     void updateAreasTransparency();
0062     void setZoomFactor( qreal factor );
0063     void setHPos( int value );
0064     void setVPos( int value );
0065     void saveChart();
0066 
0067 private:
0068     void paintMarkers( bool checked, const QSize& printSize );
0069 
0070 private:
0071     KChart::Chart* m_chart;
0072     TableModel m_model;
0073     KChart::DatasetProxyModel* m_datasetProxy;
0074     KChart::LineDiagram* m_lines;
0075     KChart::Legend* m_legend;
0076     QPixmap m_pix1, m_pix2;
0077     QLabel* m_smallChart1;
0078     QLabel* m_smallChart2;
0079 };
0080 
0081 #endif /* MAINWINDOW_H */