git-svn-id: svn://db.shs.com.ru/libs@465 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -553,6 +553,14 @@ Graphic::GraphicsData Graphic::graphicsData() const {
|
||||
}
|
||||
|
||||
|
||||
QByteArray Graphic::graphicsDataRaw() const {
|
||||
QByteArray ret;
|
||||
QDataStream s(&ret, QIODevice::WriteOnly);
|
||||
s << graphicsData();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setGraphicsData(const Graphic::GraphicsData & gd) {
|
||||
setGraphicsCount(gd.size());
|
||||
for (int i = 0; i < gd.size(); ++i)
|
||||
@@ -561,6 +569,18 @@ void Graphic::setGraphicsData(const Graphic::GraphicsData & gd) {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setGraphicsDataRaw(const QByteArray & ba) {
|
||||
if (ba.isEmpty()) {
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
Graphic::GraphicsData gd;
|
||||
QDataStream s(ba);
|
||||
s >> gd;
|
||||
setGraphicsData(gd);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setButtons(Graphic::Buttons b) {
|
||||
buttons_ = b;
|
||||
ui->buttonAutofit->setVisible(b.testFlag(Autofit));
|
||||
|
||||
@@ -98,6 +98,7 @@ class Graphic: public QFrame
|
||||
Q_PROPERTY(double histogramMinDeltaMultiplier READ histogramMinDeltaMultiplier WRITE setHistogramMinDeltaMultiplier)
|
||||
|
||||
Q_PROPERTY(Graphic::GraphicsData graphicsData READ graphicsData WRITE setGraphicsData)
|
||||
Q_PROPERTY(QByteArray graphicsDataRaw READ graphicsDataRaw WRITE setGraphicsDataRaw)
|
||||
|
||||
public:
|
||||
Graphic(QWidget * parent = 0);
|
||||
@@ -185,6 +186,7 @@ public:
|
||||
AxisType axisType() const {return axis_type_x;}
|
||||
QVector<QPointF> graphicData(const int index = 0) const {return graphics[index].polyline;}
|
||||
GraphicsData graphicsData() const;
|
||||
QByteArray graphicsDataRaw() const;
|
||||
QWidget * viewport() const {return canvas;}
|
||||
QByteArray save();
|
||||
void load(QByteArray ba);
|
||||
@@ -272,6 +274,7 @@ public slots:
|
||||
void setHistogramMaxIntervals(int value) {max_int = value; updateGraphics();}
|
||||
void setHistogramMinDeltaMultiplier(double value) {mdm = value; updateGraphics();}
|
||||
void setGraphicsData(const GraphicsData & gd);
|
||||
void setGraphicsDataRaw(const QByteArray & ba);
|
||||
|
||||
void setGridNumbersMultiplierX(double value) {grid_numbers_x = value; updateGraphics();}
|
||||
void setGridNumbersMultiplierY(double value) {grid_numbers_y = value; updateGraphics();}
|
||||
|
||||
Reference in New Issue
Block a user