[TD] some Detail View fixes
see https://forum.freecadweb.org/viewtopic.php?f=35&t=45236&p=388925#p388925 for a description of the changes
This commit is contained in:
@@ -84,9 +84,10 @@
|
||||
#include "Cosmetic.h"
|
||||
#include "EdgeWalker.h"
|
||||
#include "DrawProjectSplit.h"
|
||||
#include "DrawProjGroupItem.h"
|
||||
#include "DrawPage.h"
|
||||
#include "DrawUtil.h"
|
||||
#include "DrawViewDetail.h"
|
||||
#include "DrawProjGroupItem.h"
|
||||
#include "DrawViewSection.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
@@ -115,6 +116,9 @@ DrawViewDetail::DrawViewDetail()
|
||||
//hide Properties not relevant to DVDetail
|
||||
Direction.setStatus(App::Property::ReadOnly,true); //Should be same as BaseView
|
||||
Rotation.setStatus(App::Property::ReadOnly,true); //same as BaseView
|
||||
|
||||
//hide Properties that can only be set in Base View
|
||||
//HighlightLineColor.setStatus(App::Property::ReadOnly, true); //Should be same as BaseView
|
||||
}
|
||||
|
||||
DrawViewDetail::~DrawViewDetail()
|
||||
@@ -153,6 +157,35 @@ void DrawViewDetail::onChanged(const App::Property* prop)
|
||||
// to see AnchorPoint changes repainting is not enough, we must recompute
|
||||
recomputeFeature(true);
|
||||
}
|
||||
if (prop == &ScaleType) {
|
||||
auto page = findParentPage();
|
||||
// if ScaleType is "Page", the user cannot change it
|
||||
if (ScaleType.isValue("Page")) {
|
||||
Scale.setStatus(App::Property::ReadOnly, true);
|
||||
// apply the page-wide Scale
|
||||
if (page != nullptr) {
|
||||
if (std::abs(page->Scale.getValue() - getScale()) > FLT_EPSILON) {
|
||||
Scale.setValue(page->Scale.getValue());
|
||||
Scale.purgeTouched();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ScaleType.isValue("Custom")) {
|
||||
// allow the change Scale
|
||||
Scale.setStatus(App::Property::ReadOnly, false);
|
||||
}
|
||||
else if (ScaleType.isValue("Automatic")) {
|
||||
Scale.setStatus(App::Property::ReadOnly, true);
|
||||
// apply a Scale
|
||||
if (!checkFit(page)) {
|
||||
double newScale = autoScale(page->getPageWidth(), page->getPageHeight());
|
||||
if (std::abs(newScale - getScale()) > FLT_EPSILON) { //stops onChanged/execute loop
|
||||
Scale.setValue(newScale);
|
||||
Scale.purgeTouched();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DrawView::onChanged(prop);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ using namespace Gui;
|
||||
#define CREATEMODE 0
|
||||
#define EDITMODE 1
|
||||
|
||||
//creation ctor
|
||||
//creation constructor
|
||||
TaskDetail::TaskDetail(TechDraw::DrawViewPart* baseFeat):
|
||||
ui(new Ui_TaskDetail),
|
||||
m_detailFeat(nullptr),
|
||||
@@ -119,11 +119,11 @@ TaskDetail::TaskDetail(TechDraw::DrawViewPart* baseFeat):
|
||||
|
||||
//use editingFinished signal instead of valueChanged to prevent keyboard lock out
|
||||
//valueChanged fires every keystroke causing a recompute.
|
||||
connect(ui->qsbX, SIGNAL(editingFinished()),
|
||||
connect(ui->qsbX, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onXEdit()));
|
||||
connect(ui->qsbY, SIGNAL(editingFinished()),
|
||||
connect(ui->qsbY, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onYEdit()));
|
||||
connect(ui->qsbRadius, SIGNAL(editingFinished()),
|
||||
connect(ui->qsbRadius, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onRadiusEdit()));
|
||||
connect(ui->aeReference, SIGNAL(editingFinished()),
|
||||
this, SLOT(onReferenceEdit()));
|
||||
@@ -135,7 +135,7 @@ TaskDetail::TaskDetail(TechDraw::DrawViewPart* baseFeat):
|
||||
this, SLOT(onHighlightMoved(QPointF)));
|
||||
}
|
||||
|
||||
//edit ctor
|
||||
//edit constructor
|
||||
TaskDetail::TaskDetail(TechDraw::DrawViewDetail* detailFeat):
|
||||
ui(new Ui_TaskDetail),
|
||||
m_detailFeat(detailFeat),
|
||||
@@ -190,13 +190,14 @@ TaskDetail::TaskDetail(TechDraw::DrawViewDetail* detailFeat):
|
||||
connect(ui->pbDragger, SIGNAL(clicked(bool)),
|
||||
this, SLOT(onDraggerClicked(bool)));
|
||||
|
||||
//use editingFinished signal instead of valueChanged to prevent keyboard lock out
|
||||
//valueChanged fires every keystroke causing a recompute.
|
||||
connect(ui->qsbX, SIGNAL(editingFinished()),
|
||||
// the UI file uses setKeyboardTracking(false) so that a
|
||||
// recomputation will only be triggered when the arrow yeys of the spinboxes are used
|
||||
|
||||
connect(ui->qsbX, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onXEdit()));
|
||||
connect(ui->qsbY, SIGNAL(editingFinished()),
|
||||
connect(ui->qsbY, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onYEdit()));
|
||||
connect(ui->qsbRadius, SIGNAL(editingFinished()),
|
||||
connect(ui->qsbRadius, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onRadiusEdit()));
|
||||
connect(ui->aeReference, SIGNAL(editingFinished()),
|
||||
this, SLOT(onReferenceEdit()));
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace TechDraw
|
||||
{
|
||||
class DrawPage;
|
||||
class DrawView;
|
||||
class DrawDetail;
|
||||
class DrawViewDetail;
|
||||
class DrawViewPart;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,9 @@
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
@@ -178,6 +181,9 @@
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
@@ -194,6 +200,9 @@
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
|
||||
@@ -238,17 +238,17 @@ void TaskProjGroup::projectionTypeChanged(int index)
|
||||
|
||||
void TaskProjGroup::scaleTypeChanged(int index)
|
||||
{
|
||||
if(blockUpdate)
|
||||
if (blockUpdate)
|
||||
return;
|
||||
|
||||
//defaults to prevent scale changing
|
||||
ui->sbScaleNum->setEnabled(false);
|
||||
ui->sbScaleDen->setEnabled(false);
|
||||
|
||||
if(index == 0) {
|
||||
if (index == 0) {
|
||||
// Document Scale Type
|
||||
multiView->ScaleType.setValue("Page");
|
||||
} else if(index == 1) {
|
||||
} else if (index == 1) {
|
||||
// Automatic Scale Type
|
||||
//block recompute
|
||||
multiView->ScaleType.setValue("Automatic");
|
||||
@@ -256,7 +256,7 @@ void TaskProjGroup::scaleTypeChanged(int index)
|
||||
multiView->Scale.setValue(autoScale);
|
||||
//unblock recompute
|
||||
|
||||
} else if(index == 2) {
|
||||
} else if (index == 2) {
|
||||
// Custom Scale Type
|
||||
//block recompute
|
||||
multiView->ScaleType.setValue("Custom");
|
||||
|
||||
@@ -54,10 +54,10 @@
|
||||
#include <Mod/TechDraw/App/DrawViewDetail.h>
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawGeomHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
|
||||
#include<Mod/TechDraw/App/DrawPage.h>
|
||||
#include "QGIView.h"
|
||||
#include "TaskDetail.h"
|
||||
#include "ViewProviderViewPart.h"
|
||||
|
||||
Reference in New Issue
Block a user