Merge pull request #3365 from donovaly/TD-DetailWork

[TD] some Detail View fixes
This commit is contained in:
WandererFan
2020-06-01 20:43:01 -04:00
committed by GitHub
7 changed files with 51 additions and 13 deletions

View File

@@ -85,9 +85,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;
@@ -154,6 +155,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);
}

View File

@@ -612,7 +612,7 @@
<widget class="QLabel" name="label">
<property name="font">
<font>
<italic>true</italic>
<italic>false</italic>
</font>
</property>
<property name="text">

View File

@@ -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),
@@ -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,8 +190,8 @@ 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.
// 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(editingFinished()),
this, SLOT(onXEdit()));
connect(ui->qsbY, SIGNAL(editingFinished()),

View File

@@ -46,7 +46,7 @@ namespace TechDraw
{
class DrawPage;
class DrawView;
class DrawDetail;
class DrawViewDetail;
class DrawViewPart;
}

View File

@@ -128,6 +128,9 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>true</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>true</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>true</bool>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>

View File

@@ -233,17 +233,17 @@ void TaskProjGroup::projectionTypeChanged(QString qText)
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");
@@ -251,7 +251,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");

View File

@@ -54,11 +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 "PreferencesGui.h"
#include "QGIView.h"
#include "TaskDetail.h"