diff --git a/qad/graphic/graphic.cpp b/qad/graphic/graphic.cpp index a6ceb83..d8c4d2d 100644 --- a/qad/graphic/graphic.cpp +++ b/qad/graphic/graphic.cpp @@ -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(14, graphics); 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'); } @@ -1830,6 +1834,7 @@ void Graphic::load(QByteArray ba) { ba.remove(0, 1); QRectF vrect; ChunkStream cs(ba); + bool def_colors = false; while (!cs.atEnd()) { switch (cs.read()) { case 1: setAntialiasing(cs.getData()); break; @@ -1837,10 +1842,10 @@ void Graphic::load(QByteArray ba) { case 3: setBorderInputsVisible(cs.getData()); break; case 4: setStatusVisible(cs.getData()); break; case 5: setLegendVisible(cs.getData()); break; - case 6: setBackgroundColor(cs.getData()); break; - case 7: setTextColor(cs.getData()); break; + case 6: if (!def_colors) setBackgroundColor(cs.getData()); break; + case 7: if (!def_colors) setTextColor(cs.getData()); break; case 8: setMargins(cs.getData()); break; - case 9: setGridPen(cs.getData()); break; + case 9: if (!def_colors) setGridPen(cs.getData()); break; case 10: setGraduationX(cs.getData()); break; case 11: setGraduationY(cs.getData()); break; case 12: setGraduationStepX(cs.getData()); break; @@ -1848,6 +1853,12 @@ void Graphic::load(QByteArray ba) { case 14: graphics = cs.getData >(); break; case 15: isFit = cs.getData(); break; case 16: vrect = cs.getData(); break; + case 17: if(cs.getData()) { + 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; } }