DrawViewSymbol forgets Scale on restore

This commit is contained in:
WandererFan 2016-07-12 15:20:08 -04:00
parent 2ac560e7b0
commit 1a87644f44
3 changed files with 12 additions and 6 deletions

View File

@ -70,7 +70,7 @@ DrawView::DrawView(void)
ScaleType.setEnums(ScaleTypeEnums);
ADD_PROPERTY_TYPE(ScaleType,((long)0),group, App::Prop_None, "Scale Type");
ADD_PROPERTY_TYPE(Scale ,(1.0),group,App::Prop_None,"Scale factor of the view");
Scale.setStatus(App::Property::ReadOnly,true);
//Scale.setStatus(App::Property::ReadOnly,true);
autoPos = true;
@ -119,14 +119,15 @@ void DrawView::onChanged(const App::Property* prop)
TechDraw::DrawPage *page = findParentPage();
if(page) {
if(std::abs(page->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
Scale.setValue(page->Scale.getValue()); // Recalculate scale from page
Scale.setValue(page->Scale.getValue()); // Reset scale from page
Scale.touch();
}
}
Scale.setStatus(App::Property::ReadOnly,true);
App::GetApplication().signalChangePropertyEditor(Scale);
} else if (ScaleType.isValue("Custom") &&
Scale.testStatus(App::Property::ReadOnly)) {
} else if ( ScaleType.isValue("Custom") ) {
// } else if (ScaleType.isValue("Custom") &&
// Scale.testStatus(App::Property::ReadOnly)) {
Scale.setStatus(App::Property::ReadOnly,false);
App::GetApplication().signalChangePropertyEditor(Scale);
}

View File

@ -251,7 +251,9 @@ void QGIView::updateView(bool update)
if (update ||
getViewObject()->Rotation.isTouched()) {
//NOTE: QPainterPaths have to be rotated individually. This transform handles everything else.
//NOTE: QPainterPaths have to be rotated individually. This transform handles Rotation for everything else.
//Scale is handled in GeometryObject for DVP & descendents
//Objects not descended from DVP must setScale for themselves
double rot = getViewObject()->Rotation.getValue();
QPointF centre = boundingRect().center();
setTransform(QTransform().translate(centre.x(), centre.y()).rotate(-rot).translate(-centre.x(), -centre.y()));

View File

@ -89,7 +89,6 @@ void QGIViewSymbol::updateView(bool update)
}
if (viewSymbol->Scale.isTouched()) {
setScale(viewSymbol->Scale.getValue());
draw();
}
@ -102,6 +101,10 @@ void QGIViewSymbol::draw()
return;
}
//note: svg's are overscaled by (72 pixels(pts actually) /in)*(1 in/25.4 mm) = 2.834645669 (could be 96/25.4(CSS)? 110/25.4?)
//due to 1 sceneUnit (1mm) = 1 pixel for some QtSvg functions
TechDraw::DrawViewSymbol *viewSymbol = dynamic_cast<TechDraw::DrawViewSymbol *>(getViewObject());
setScale(viewSymbol->Scale.getValue());
drawSvg();
if (borderVisible) {
drawBorder();