moved to shstk
This commit is contained in:
111
libs/graphic/graphic_conf.h
Normal file
111
libs/graphic/graphic_conf.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
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 <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include <QPen>
|
||||
#include <QPainter>
|
||||
#include "qad_graphic_export.h"
|
||||
|
||||
|
||||
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) {
|
||||
pen.setColor(color);
|
||||
pen.setStyle(style);
|
||||
lines = true;
|
||||
points = false;
|
||||
fill = false;
|
||||
fill_color = Qt::yellow;
|
||||
if (qRound(width) == width) pen.setWidth(qRound(width));
|
||||
else pen.setWidthF(width);
|
||||
pen.setWidth(1);
|
||||
pen.setCosmetic(true);
|
||||
max_x = 0.;
|
||||
name = name_;
|
||||
visible = visible_;
|
||||
pointWidth = 2.;
|
||||
pb = new QCheckBox(name);
|
||||
}
|
||||
//~GraphicType() {delete pb;}
|
||||
QString name;
|
||||
QPolygonF polyline;
|
||||
QPolygonF polyline_pause;
|
||||
QPen pen;
|
||||
QColor fill_color;
|
||||
bool lines;
|
||||
bool points;
|
||||
bool fill;
|
||||
double pointWidth;
|
||||
double max_x;
|
||||
double max_x_pause;
|
||||
QCheckBox * pb;
|
||||
QIcon icon;
|
||||
bool visible;
|
||||
QRectF cvrect;
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
#endif // GRAPHIC_CONF_H
|
||||
Reference in New Issue
Block a user