120 lines
3.1 KiB
C++
120 lines
3.1 KiB
C++
/*
|
|
QAD - Qt ADvanced
|
|
|
|
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef GRAPHIC_CONF_H
|
|
#define GRAPHIC_CONF_H
|
|
|
|
#include "qad_graphic_export.h"
|
|
|
|
#include <QCheckBox>
|
|
#include <QDialog>
|
|
#include <QPainter>
|
|
#include <QPen>
|
|
|
|
|
|
namespace Ui {
|
|
class GraphicConf;
|
|
}
|
|
|
|
|
|
struct QAD_GRAPHIC_EXPORT GraphicType {
|
|
GraphicType(QString name_ = "y(x)",
|
|
QColor color = Qt::red,
|
|
Qt::PenStyle style = Qt::SolidLine,
|
|
double width = 0.,
|
|
bool visible_ = true);
|
|
void removeData();
|
|
bool init();
|
|
void destroy();
|
|
//~GraphicType() {delete pb;}
|
|
QString name;
|
|
QPolygonF polyline;
|
|
QPolygonF polyline_pause;
|
|
QVector<QPolygonF> _lod;
|
|
QVector<QPolygonF> _lod_pause;
|
|
QPen pen;
|
|
QColor fill_color;
|
|
bool lines;
|
|
bool points;
|
|
bool fill;
|
|
double pointWidth;
|
|
double max_x;
|
|
double max_x_pause;
|
|
QCheckBox * pb = nullptr;
|
|
QIcon icon;
|
|
bool visible;
|
|
QRectF cvrect;
|
|
int last_lod = 0;
|
|
};
|
|
|
|
|
|
inline QDataStream & operator<<(QDataStream & s, const GraphicType & v) {
|
|
s << v.name << v.pen << v.fill_color << v.lines << v.points << v.fill << v.pointWidth << v.visible;
|
|
return s;
|
|
}
|
|
inline QDataStream & operator>>(QDataStream & s, GraphicType & v) {
|
|
s >> v.name >> v.pen >> v.fill_color >> v.lines >> v.points >> v.fill >> v.pointWidth >> v.visible;
|
|
return s;
|
|
}
|
|
|
|
|
|
class QAD_GRAPHIC_EXPORT GraphicConf: public QDialog {
|
|
Q_OBJECT
|
|
friend class Graphic;
|
|
|
|
public:
|
|
explicit GraphicConf(QVector<GraphicType> & graphics_, QWidget * parent = 0);
|
|
|
|
struct QAD_GRAPHIC_EXPORT GraphicItem {
|
|
QString name;
|
|
QIcon icon;
|
|
};
|
|
|
|
void readParams();
|
|
|
|
QVector<GraphicType> & graphics;
|
|
QVector<GraphicItem> graphicItems;
|
|
|
|
protected:
|
|
void changeEvent(QEvent * e);
|
|
|
|
Ui::GraphicConf * ui;
|
|
|
|
private slots:
|
|
void on_cbGraphicNames_currentIndexChanged(int index);
|
|
void on_colorGraphic_colorChanged(const QColor &);
|
|
void on_colorFill_colorChanged(const QColor &);
|
|
void on_comboStyleGraphic_currentIndexChanged(int index);
|
|
void on_spinLineWidthGraphic_valueChanged(double value);
|
|
void on_spinPointWidthGraphic_valueChanged(double value);
|
|
void on_checkLines_toggled(bool on);
|
|
void on_checkPoints_toggled(bool on);
|
|
void on_checkFill_toggled(bool on);
|
|
void on_spinLineWidthGraphicAll_valueChanged(double value);
|
|
void on_spinPointWidthGraphicAll_valueChanged(double value);
|
|
void on_checkLinesAll_toggled(bool on);
|
|
void on_checkPointsAll_toggled(bool on);
|
|
void on_buttonExport_clicked();
|
|
|
|
signals:
|
|
void exportClicked();
|
|
};
|
|
|
|
#endif // GRAPHIC_CONF_H
|