[TD] add scale settings to detail task dialog
This commit is contained in:
@@ -125,6 +125,10 @@ TaskDetail::TaskDetail(TechDraw::DrawViewPart* baseFeat):
|
||||
this, SLOT(onYEdit()));
|
||||
connect(ui->qsbRadius, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onRadiusEdit()));
|
||||
connect(ui->cbScaleType, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onScaleTypeEdit()));
|
||||
connect(ui->qsbScale, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onScaleEdit()));
|
||||
connect(ui->leReference, SIGNAL(editingFinished()),
|
||||
this, SLOT(onReferenceEdit()));
|
||||
|
||||
@@ -198,6 +202,10 @@ TaskDetail::TaskDetail(TechDraw::DrawViewDetail* detailFeat):
|
||||
this, SLOT(onYEdit()));
|
||||
connect(ui->qsbRadius, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onRadiusEdit()));
|
||||
connect(ui->cbScaleType, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onScaleTypeEdit()));
|
||||
connect(ui->qsbScale, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onScaleEdit()));
|
||||
connect(ui->leReference, SIGNAL(editingFinished()),
|
||||
this, SLOT(onReferenceEdit()));
|
||||
|
||||
@@ -257,7 +265,6 @@ void TaskDetail::setUiFromFeat()
|
||||
}
|
||||
|
||||
Base::Vector3d anchor;
|
||||
double radius;
|
||||
|
||||
TechDraw::DrawViewDetail* detailFeat = getDetailFeat();
|
||||
QString detailDisplay = QString::fromUtf8(detailFeat->getNameInDocument()) +
|
||||
@@ -265,7 +272,9 @@ void TaskDetail::setUiFromFeat()
|
||||
QString::fromUtf8(detailFeat->Label.getValue());
|
||||
ui->leDetailView->setText(detailDisplay);
|
||||
anchor = detailFeat->AnchorPoint.getValue();
|
||||
radius = detailFeat->Radius.getValue();
|
||||
double radius = detailFeat->Radius.getValue();
|
||||
long ScaleType = detailFeat->ScaleType.getValue();
|
||||
double scale = detailFeat->Scale.getValue();
|
||||
QString ref = QString::fromUtf8(detailFeat->Reference.getValue());
|
||||
|
||||
ui->pbDragger->setText(QString::fromUtf8("Drag Highlight"));
|
||||
@@ -273,13 +282,20 @@ void TaskDetail::setUiFromFeat()
|
||||
int decimals = Base::UnitsApi::getDecimals();
|
||||
ui->qsbX->setUnit(Base::Unit::Length);
|
||||
ui->qsbX->setDecimals(decimals);
|
||||
ui->qsbX->setValue(anchor.x);
|
||||
ui->qsbY->setUnit(Base::Unit::Length);
|
||||
ui->qsbY->setDecimals(decimals);
|
||||
ui->qsbY->setValue(anchor.y);
|
||||
ui->qsbRadius->setDecimals(decimals);
|
||||
ui->qsbRadius->setUnit(Base::Unit::Length);
|
||||
ui->qsbX->setValue(anchor.x);
|
||||
ui->qsbY->setValue(anchor.y);
|
||||
ui->qsbRadius->setValue(radius);
|
||||
ui->qsbScale->setDecimals(decimals);
|
||||
ui->cbScaleType->setCurrentIndex(ScaleType);
|
||||
if (ui->cbScaleType->currentIndex() == 2) // only if custom scale
|
||||
ui->qsbScale->setEnabled(true);
|
||||
else
|
||||
ui->qsbScale->setEnabled(false);
|
||||
ui->qsbScale->setValue(scale);
|
||||
ui->leReference->setText(ref);
|
||||
}
|
||||
|
||||
@@ -294,6 +310,8 @@ void TaskDetail::enableInputFields(bool b)
|
||||
{
|
||||
ui->qsbX->setEnabled(b);
|
||||
ui->qsbY->setEnabled(b);
|
||||
if (ui->cbScaleType->currentIndex() == 2) // only if custom scale
|
||||
ui->qsbScale->setEnabled(b);
|
||||
ui->qsbRadius->setEnabled(b);
|
||||
ui->leReference->setEnabled(b);
|
||||
}
|
||||
@@ -313,9 +331,45 @@ void TaskDetail::onRadiusEdit()
|
||||
updateDetail();
|
||||
}
|
||||
|
||||
void TaskDetail::onScaleTypeEdit()
|
||||
{
|
||||
TechDraw::DrawViewDetail* detailFeat = getDetailFeat();
|
||||
|
||||
if (ui->cbScaleType->currentIndex() == 0) {
|
||||
// page scale
|
||||
ui->qsbScale->setEnabled(false);
|
||||
detailFeat->ScaleType.setValue(0.0);
|
||||
// set the page scale if there is a valid page
|
||||
if (m_basePage != nullptr) {
|
||||
// set the page scale
|
||||
detailFeat->Scale.setValue(m_basePage->Scale.getValue());
|
||||
ui->qsbScale->setValue(m_basePage->Scale.getValue());
|
||||
}
|
||||
// finally update the view
|
||||
updateDetail();
|
||||
}
|
||||
else if (ui->cbScaleType->currentIndex() == 1) {
|
||||
// automatic scale
|
||||
ui->qsbScale->setEnabled(false);
|
||||
detailFeat->ScaleType.setValue(1.0);
|
||||
// don't do anything here since automatic scaling is only possible for DrawView
|
||||
}
|
||||
else if (ui->cbScaleType->currentIndex() == 2) {
|
||||
// custom scale
|
||||
ui->qsbScale->setEnabled(true);
|
||||
detailFeat->ScaleType.setValue(2.0);
|
||||
// no updateDetail() necessary since nothing visibly was changed
|
||||
}
|
||||
}
|
||||
|
||||
void TaskDetail::onScaleEdit()
|
||||
{
|
||||
updateDetail();
|
||||
}
|
||||
|
||||
void TaskDetail::onReferenceEdit()
|
||||
{
|
||||
updateDetail(); //<<<<<
|
||||
updateDetail();
|
||||
}
|
||||
|
||||
void TaskDetail::onDraggerClicked(bool b)
|
||||
@@ -437,7 +491,8 @@ void TaskDetail::updateDetail()
|
||||
Base::Vector3d temp(x, y, 0.0);
|
||||
TechDraw::DrawViewDetail* detailFeat = getDetailFeat();
|
||||
detailFeat->AnchorPoint.setValue(temp);
|
||||
|
||||
double scale = ui->qsbScale->rawValue();
|
||||
detailFeat->Scale.setValue(scale);
|
||||
double radius = ui->qsbRadius->rawValue();
|
||||
detailFeat->Radius.setValue(radius);
|
||||
QString qRef = ui->leReference->text();
|
||||
|
||||
@@ -76,6 +76,8 @@ public Q_SLOTS:
|
||||
void onXEdit();
|
||||
void onYEdit();
|
||||
void onRadiusEdit();
|
||||
void onScaleTypeEdit();
|
||||
void onScaleEdit();
|
||||
void onReferenceEdit();
|
||||
|
||||
public:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>304</width>
|
||||
<height>253</height>
|
||||
<height>264</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -119,30 +119,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="2,1,2">
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbRadius">
|
||||
<property name="toolTip">
|
||||
<string>size of detail view</string>
|
||||
</property>
|
||||
<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>
|
||||
<property name="value">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="2,0,0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
<string>Reference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -159,20 +140,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbX">
|
||||
<property name="toolTip">
|
||||
@@ -192,6 +159,88 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbScale">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>scale factor for detail view</string>
|
||||
</property>
|
||||
<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>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbRadius">
|
||||
<property name="toolTip">
|
||||
<string>size of detail view</string>
|
||||
</property>
|
||||
<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>
|
||||
<property name="value">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Scale</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Radius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="leReference">
|
||||
<property name="toolTip">
|
||||
<string>reference label</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbY">
|
||||
<property name="toolTip">
|
||||
@@ -208,24 +257,29 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Radius</string>
|
||||
</property>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="cbScaleType">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Page</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Reference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLineEdit" name="leReference">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<string>Scale Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user