graphic default theme color in session save/load
This commit is contained in:
@@ -1817,6 +1817,10 @@ QByteArray Graphic::save() {
|
|||||||
cs.add(9, gridPen()).add(10, graduationX()).add(11, graduationY()).add(12, graduationStepX()).add(13, graduationStepY());
|
cs.add(9, gridPen()).add(10, graduationX()).add(11, graduationY()).add(12, graduationStepX()).add(13, graduationStepY());
|
||||||
cs.add(14, graphics);
|
cs.add(14, graphics);
|
||||||
cs.add(15, isFit).add(16, visualRect());
|
cs.add(15, isFit).add(16, visualRect());
|
||||||
|
if (backgroundColor() == palette().color(QPalette::Base) &&
|
||||||
|
textColor() == palette().color(QPalette::WindowText) &&
|
||||||
|
gridColor() == palette().color(QPalette::Disabled, QPalette::WindowText))
|
||||||
|
cs.add(17, true);
|
||||||
return cs.data().prepend('2');
|
return cs.data().prepend('2');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1830,6 +1834,7 @@ void Graphic::load(QByteArray ba) {
|
|||||||
ba.remove(0, 1);
|
ba.remove(0, 1);
|
||||||
QRectF vrect;
|
QRectF vrect;
|
||||||
ChunkStream cs(ba);
|
ChunkStream cs(ba);
|
||||||
|
bool def_colors = false;
|
||||||
while (!cs.atEnd()) {
|
while (!cs.atEnd()) {
|
||||||
switch (cs.read()) {
|
switch (cs.read()) {
|
||||||
case 1: setAntialiasing(cs.getData<bool>()); break;
|
case 1: setAntialiasing(cs.getData<bool>()); break;
|
||||||
@@ -1837,10 +1842,10 @@ void Graphic::load(QByteArray ba) {
|
|||||||
case 3: setBorderInputsVisible(cs.getData<bool>()); break;
|
case 3: setBorderInputsVisible(cs.getData<bool>()); break;
|
||||||
case 4: setStatusVisible(cs.getData<bool>()); break;
|
case 4: setStatusVisible(cs.getData<bool>()); break;
|
||||||
case 5: setLegendVisible(cs.getData<bool>()); break;
|
case 5: setLegendVisible(cs.getData<bool>()); break;
|
||||||
case 6: setBackgroundColor(cs.getData<QColor>()); break;
|
case 6: if (!def_colors) setBackgroundColor(cs.getData<QColor>()); break;
|
||||||
case 7: setTextColor(cs.getData<QColor>()); break;
|
case 7: if (!def_colors) setTextColor(cs.getData<QColor>()); break;
|
||||||
case 8: setMargins(cs.getData<QRect>()); break;
|
case 8: setMargins(cs.getData<QRect>()); break;
|
||||||
case 9: setGridPen(cs.getData<QPen>()); break;
|
case 9: if (!def_colors) setGridPen(cs.getData<QPen>()); break;
|
||||||
case 10: setGraduationX(cs.getData<Graduation>()); break;
|
case 10: setGraduationX(cs.getData<Graduation>()); break;
|
||||||
case 11: setGraduationY(cs.getData<Graduation>()); break;
|
case 11: setGraduationY(cs.getData<Graduation>()); break;
|
||||||
case 12: setGraduationStepX(cs.getData<double>()); break;
|
case 12: setGraduationStepX(cs.getData<double>()); break;
|
||||||
@@ -1848,6 +1853,12 @@ void Graphic::load(QByteArray ba) {
|
|||||||
case 14: graphics = cs.getData<QVector<GraphicType> >(); break;
|
case 14: graphics = cs.getData<QVector<GraphicType> >(); break;
|
||||||
case 15: isFit = cs.getData<bool>(); break;
|
case 15: isFit = cs.getData<bool>(); break;
|
||||||
case 16: vrect = cs.getData<QRectF>(); break;
|
case 16: vrect = cs.getData<QRectF>(); break;
|
||||||
|
case 17: if(cs.getData<bool>()) {
|
||||||
|
setTextColor(palette().color(QPalette::WindowText));
|
||||||
|
setGridPen(QPen(palette().color(QPalette::Disabled, QPalette::WindowText), 0., Qt::DotLine));
|
||||||
|
setBackgroundColor(palette().color(QPalette::Base));
|
||||||
|
def_colors = true;
|
||||||
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user