Merge pull request #19941 from WandererFan/PropertiesAndSpinBoxes

[TD]Properties and spin boxes
This commit is contained in:
Chris Hennes
2025-03-10 16:55:13 +00:00
committed by GitHub
11 changed files with 342 additions and 223 deletions

View File

@@ -139,7 +139,6 @@ void DrawViewDetail::onChanged(const App::Property* prop)
App::DocumentObjectExecReturn* DrawViewDetail::execute()
{
// Base::Console().Message("DVD::execute() - %s\n", getNameInDocument());
if (!keepUpdated()) {
return DrawView::execute();
}
@@ -254,6 +253,7 @@ void DrawViewDetail::makeDetailShape(const TopoDS_Shape& shape3d, DrawViewPart*
TopoDS_Face extrusionFace;
Base::Vector3d extrudeVec = dirDetail * extrudeLength;
gp_Vec extrudeDir(extrudeVec.x, extrudeVec.y, extrudeVec.z);
TopoDS_Shape tool;
if (Preferences::mattingStyle()) {
@@ -381,7 +381,6 @@ void DrawViewDetail::makeDetailShape(const TopoDS_Shape& shape3d, DrawViewPart*
void DrawViewDetail::postHlrTasks(void)
{
// Base::Console().Message("DVD::postHlrTasks()\n");
DrawViewPart::postHlrTasks();
geometryObject->pruneVertexGeom(Base::Vector3d(0.0, 0.0, 0.0),
@@ -465,9 +464,35 @@ bool DrawViewDetail::debugDetail() const
return Preferences::getPreferenceGroup("debug")->GetBool("debugDetail", false);
}
void DrawViewDetail::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop)
{
if (prop == &AnchorPoint) {
// AnchorPoint was PropertyVector but is now PropertyPosition
App::PropertyVector tmp;
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
tmp.setContainer(this);
tmp.Restore(reader);
auto tmpValue = tmp.getValue();
AnchorPoint.setValue(tmpValue);
}
return;
}
if (prop == &Radius) {
// Radius was PropertyFloat but is now PropertyLength
App::PropertyLength tmp;
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
tmp.setContainer(this);
tmp.Restore(reader);
auto tmpValue = tmp.getValue();
Radius.setValue(tmpValue);
}
return;
}
}
void DrawViewDetail::unsetupObject()
{
// Base::Console().Message("DVD::unsetupObject()\n");
App::DocumentObject* baseObj = BaseView.getValue();
DrawView* base = dynamic_cast<DrawView*>(baseObj);
if (base) {

View File

@@ -57,8 +57,8 @@ public:
~DrawViewDetail() override;
App::PropertyLink BaseView;
App::PropertyVector AnchorPoint;
App::PropertyFloat Radius;
App::PropertyPosition AnchorPoint;
App::PropertyLength Radius;
App::PropertyString Reference;
App::PropertyBool ShowMatting;
@@ -71,6 +71,8 @@ public:
return "TechDrawGui::ViewProviderViewPart";
}
void unsetupObject() override;
void handleChangedPropertyType(
Base::XMLReader &reader, const char * TypeName, App::Property * prop) override;
void detailExec(TopoDS_Shape& s,

View File

@@ -1042,6 +1042,7 @@ bool DrawViewPart::hasGeometry() const
const std::vector<TechDraw::VertexPtr>& verts = getVertexGeometry();
const std::vector<TechDraw::BaseGeomPtr>& edges = getEdgeGeometry();
return !(verts.empty() && edges.empty());
}
@@ -1469,6 +1470,33 @@ void DrawViewPart::resetReferenceVerts()
addReferencesToGeom();
}
void DrawViewPart::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop)
{
if (prop == &Direction) {
// Direction was PropertyVector but is now PropertyDirection
App::PropertyVector tmp;
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
tmp.setContainer(this);
tmp.Restore(reader);
auto tmpValue = tmp.getValue();
Direction.setValue(tmpValue);
}
return;
}
if (prop == &XDirection) {
// XDirection was PropertyFloat but is now PropertyLength
App::PropertyVector tmp;
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
tmp.setContainer(this);
tmp.Restore(reader);
auto tmpValue = tmp.getValue();
XDirection.setValue(tmpValue);
}
return;
}
}
// debugging ----------------------------------------------------------------------------
void DrawViewPart::dumpVerts(std::string text)

View File

@@ -115,9 +115,8 @@ public:
App::PropertyLinkList Source;
App::PropertyXLinkList XSource;
App::PropertyVector
Direction;//TODO: Rename to YAxisDirection or whatever this actually is (ProjectionDirection)
App::PropertyVector XDirection;
App::PropertyDirection Direction; // the projection direction
App::PropertyDirection XDirection;
App::PropertyBool Perspective;
App::PropertyDistance Focus;
@@ -140,6 +139,8 @@ public:
App::DocumentObjectExecReturn* execute() override;
const char* getViewProviderName() const override { return "TechDrawGui::ViewProviderViewPart"; }
PyObject* getPyObject() override;
void handleChangedPropertyType(
Base::XMLReader &reader, const char * TypeName, App::Property * prop) override;
static TopoDS_Shape centerScaleRotate(const DrawViewPart* dvp, TopoDS_Shape& inOutShape,
Base::Vector3d centroid);

View File

@@ -66,7 +66,6 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <chrono>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Dir.hxx>
@@ -735,7 +734,7 @@ TopoDS_Compound DrawViewSection::findSectionPlaneIntersections(const TopoDS_Shap
-m_shapeSize,
m_shapeSize);
BRepTools::Write(mkFace.Face(), "DVSSectionPlane.brep");// debug
BRepTools::Write(shape, "DVSShapeToIntersect.brep)");
BRepTools::Write(shape, "DVSShapeToIntersect.brep");
}
BRep_Builder builder;
TopoDS_Compound result;
@@ -759,10 +758,6 @@ TopoDS_Compound DrawViewSection::findSectionPlaneIntersections(const TopoDS_Shap
// move section faces to line up with cut shape
TopoDS_Compound DrawViewSection::alignSectionFaces(TopoDS_Shape faceIntersections)
{
// Base::Console().Message("DVS::alignSectionFaces() - %s -
// faceIntersection.isnull: %d\n",
// getNameInDocument(),
// faceIntersections.IsNull());
TopoDS_Compound sectionFaces;
TopoDS_Shape centeredShape =
ShapeUtils::moveShape(faceIntersections, getOriginalCentroid() * -1.0);
@@ -773,6 +768,10 @@ TopoDS_Compound DrawViewSection::alignSectionFaces(TopoDS_Shape faceIntersection
ShapeUtils::rotateShape(scaledSection, getProjectionCS(), Rotation.getValue());
}
if (debugSection()) {
BRepTools::Write(scaledSection, "DVSScaledSectionFaces.brep");
}
return mapToPage(scaledSection);
}
@@ -796,12 +795,23 @@ TopoDS_Compound DrawViewSection::mapToPage(TopoDS_Shape& shapeToAlign)
TopExp_Explorer expFace(shapeToAlign, TopAbs_FACE);
for (int iFace = 1; expFace.More(); expFace.Next(), iFace++) {
const TopoDS_Face& face = TopoDS::Face(expFace.Current());
if (debugSection()) {
std::stringstream ss;
ss << "DVSFace" << iFace << ".brep";
BRepTools::Write(face, ss.str().c_str());// debug
}
std::vector<TopoDS_Wire> faceWires;
TopExp_Explorer expWires(face, TopAbs_WIRE);
for (; expWires.More(); expWires.Next()) {
const TopoDS_Wire& wire = TopoDS::Wire(expWires.Current());
TopoDS_Shape projectedShape =
GeometryObject::projectSimpleShape(wire, getProjectionCS());
TopoDS_Shape projectedShape = GeometryObject::projectSimpleShape(wire, getProjectionCS());
if (debugSection()) {
std::stringstream ss;
ss << "DVSProjectedWire" << iFace << ".brep";
BRepTools::Write(projectedShape, ss.str().c_str());// debug
}
std::vector<TopoDS_Edge> wireEdges;
// projectedShape is just a bunch of edges. we have to rebuild the wire.
TopExp_Explorer expEdges(projectedShape, TopAbs_EDGE);
@@ -809,6 +819,7 @@ TopoDS_Compound DrawViewSection::mapToPage(TopoDS_Shape& shapeToAlign)
const TopoDS_Edge& edge = TopoDS::Edge(expEdges.Current());
wireEdges.push_back(edge);
}
TopoDS_Wire cleanWire = EdgeWalker::makeCleanWire(wireEdges, 2.0 * EWTOLERANCE);
faceWires.push_back(cleanWire);
}
@@ -1225,6 +1236,33 @@ void DrawViewSection::setupObject()
DrawViewPart::setupObject();
}
void DrawViewSection::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop)
{
if (prop == &SectionOrigin) {
// SectionOrigin was PropertyVector but is now PropertyPosition
App::PropertyVector tmp;
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
tmp.setContainer(this);
tmp.Restore(reader);
auto tmpValue = tmp.getValue();
SectionOrigin.setValue(tmpValue);
}
return;
}
if (prop == &SectionNormal) {
// Radius was PropertyVector but is now PropertyDirection
App::PropertyVector tmp;
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
tmp.setContainer(this);
tmp.Restore(reader);
auto tmpValue = tmp.getValue();
SectionNormal.setValue(tmpValue);
}
return;
}
}
// hatch file routines
// create geometric hatch lines

View File

@@ -84,8 +84,8 @@ public:
~DrawViewSection() override;
App::PropertyLink BaseView;
App::PropertyVector SectionNormal;
App::PropertyVector SectionOrigin;
App::PropertyDirection SectionNormal;
App::PropertyPosition SectionOrigin;
App::PropertyString SectionSymbol;
@@ -118,6 +118,8 @@ public:
}
void unsetupObject() override;
short mustExecute() const override;
void handleChangedPropertyType(
Base::XMLReader &reader, const char * TypeName, App::Property * prop) override;
void sectionExec(TopoDS_Shape& s);
virtual void makeSectionCut(const TopoDS_Shape& baseShape);

View File

@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>264</height>
<width>497</width>
<height>367</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Detail Anchor</string>
</property>
@@ -107,95 +113,7 @@
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="2,0,0">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string notr="true">X</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbX">
<property name="toolTip">
<string>x position of detail highlight within 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>0.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string notr="true">Y</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbY">
<property name="toolTip">
<string>y position of detail highlight within 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>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Radius</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>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,0,2">
<item row="3" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
@@ -203,35 +121,13 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="cbScaleType">
<item row="5" column="2">
<widget class="QLineEdit" name="leReference">
<property name="toolTip">
<string>Page: scale factor of page is used
Automatic: if the detail view is larger than the page,
it will be scaled down to fit into the page
Custom: custom scale factor is used</string>
<string>reference label</string>
</property>
<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="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Scale Factor</string>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@@ -260,6 +156,60 @@ Custom: custom scale factor is used</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbY">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>y position of detail highlight within 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>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Scale Factor</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbRadius">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<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="5" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
@@ -267,16 +217,84 @@ Custom: custom scale factor is used</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLineEdit" name="leReference">
<item row="0" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbX">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>reference label</string>
<string>x position of detail highlight within view</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</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="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string notr="true">X</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="cbScaleType">
<property name="toolTip">
<string>Page: scale factor of page is used
Automatic: if the detail view is larger than the page,
it will be scaled down to fit into the page
Custom: custom scale factor is used</string>
</property>
<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="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string notr="true">Y</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>

View File

@@ -171,7 +171,7 @@ void TaskSectionView::setUiEdit()
ui->sbScale->setEnabled(false);
}
Base::Vector3d origin = m_section->SectionOrigin.getValue();
auto origin = m_section->SectionOrigin.getValue();
setUiCommon(origin);
// convert section normal to view angle

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>370</width>
<height>508</height>
<width>442</width>
<height>528</height>
</rect>
</property>
<property name="sizePolicy">
@@ -50,7 +50,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
<height>24</height>
</size>
</property>
</widget>
@@ -67,7 +67,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
<height>24</height>
</size>
</property>
<property name="toolTip">
@@ -87,7 +87,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
<height>24</height>
</size>
</property>
<property name="toolTip">
@@ -299,7 +299,48 @@
</property>
<layout class="QVBoxLayout" name="verticalLayoutPlane">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout" columnstretch="1,0">
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgY">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>24</height>
</size>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string notr="true">Z</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
@@ -319,20 +360,20 @@
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgX">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -343,7 +384,7 @@
<property name="minimumSize">
<size>
<width>150</width>
<height>22</height>
<height>24</height>
</size>
</property>
<property name="keyboardTracking">
@@ -354,7 +395,29 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgZ">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>24</height>
</size>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -373,69 +436,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="Gui::QuantitySpinBox" name="sbOrgY">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>22</height>
</size>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string notr="true">Z</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::QuantitySpinBox" name="sbOrgZ">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>22</height>
</size>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -37,6 +37,8 @@
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Gui/QuantitySpinBox.h>
#include <Base/Console.h>
#include <Base/Tools.h>
@@ -68,13 +70,13 @@ bool CompassWidget::eventFilter(QObject* target, QEvent* event)
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) {
dsbAngle->interpretText();
slotSpinBoxEnter(dsbAngle->value());
slotSpinBoxEnter(dsbAngle->rawValue());
return true;
}
}
else if (event->type() == QEvent::FocusOut) {
dsbAngle->interpretText();
slotSpinBoxEnter(dsbAngle->value());
slotSpinBoxEnter(dsbAngle->rawValue());
return true;
}
}
@@ -128,9 +130,9 @@ void CompassWidget::buildWidget()
compassControlLabel->setSizePolicy(sizePolicy2);
compassControlLayout->addWidget(compassControlLabel);
dsbAngle = new QDoubleSpinBox(this);
dsbAngle = new Gui::QuantitySpinBox(this);
dsbAngle->setObjectName(QStringLiteral("dsbAngle"));
dsbAngle->setUnit(Base::Unit::Angle);
sizePolicy2.setHeightForWidth(dsbAngle->sizePolicy().hasHeightForWidth());
dsbAngle->setSizePolicy(sizePolicy2);
dsbAngle->setMinimumSize(QSize(75, 26));
@@ -138,7 +140,6 @@ void CompassWidget::buildWidget()
dsbAngle->setFocusPolicy(Qt::ClickFocus);
dsbAngle->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
dsbAngle->setKeyboardTracking(false);
dsbAngle->setSuffix(QStringLiteral("\302\260"));
dsbAngle->setMaximum(360.000000000000000);
dsbAngle->setMinimum(-360.000000000000000);

View File

@@ -35,6 +35,10 @@ class QPushButton;
class QVBoxLayout;
QT_END_NAMESPACE
namespace Gui {
class QuantitySpinBox;
}
namespace TechDrawGui
{
@@ -94,7 +98,7 @@ private:
CompassDialWidget* compassDial;
// DoubleSpinBoxNoEnter* dsbAngle;
QDoubleSpinBox* dsbAngle;
Gui::QuantitySpinBox* dsbAngle;
QLabel* compassControlLabel;
QPushButton* pbCWAdvance;
QPushButton* pbCCWAdvance;