Sketcher: Reimplement strikethrough of inactive constraint labels
This commit is contained in:
@@ -147,6 +147,7 @@ SoDatumLabel::SoDatumLabel()
|
||||
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0F, 1.0F, 1.0F)));
|
||||
SO_NODE_ADD_FIELD(pnts, (SbVec3f(.0F, .0F, .0F)));
|
||||
SO_NODE_ADD_FIELD(norm, (SbVec3f(.0F, .0F, 1.F)));
|
||||
SO_NODE_ADD_FIELD(strikethrough, (false));
|
||||
|
||||
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
||||
SO_NODE_ADD_FIELD(size, (10.F));
|
||||
@@ -215,9 +216,13 @@ void SoDatumLabel::drawImage()
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
}
|
||||
|
||||
painter.setPen(front);
|
||||
painter.setPen(QPen(front, 2));
|
||||
painter.setFont(font);
|
||||
painter.drawText(0, fm.ascent() + rect.y(), w, rect.height(), Qt::AlignLeft, str);
|
||||
if (strikethrough.getValue()) {
|
||||
int strikepos = fm.ascent() - fm.strikeOutPos();
|
||||
painter.drawLine(0, strikepos, w, strikepos);
|
||||
}
|
||||
painter.end();
|
||||
|
||||
Gui::BitmapFactory().convert(image, this->image);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define GUI_SODATUMLABEL_H
|
||||
|
||||
#include <Inventor/SbBox3f.h>
|
||||
#include <Inventor/fields/SoSFBool.h>
|
||||
#include <Inventor/fields/SoSFColor.h>
|
||||
#include <Inventor/fields/SoSFEnum.h>
|
||||
#include <Inventor/fields/SoSFFloat.h>
|
||||
@@ -87,6 +88,7 @@ public:
|
||||
SoSFFloat param8;
|
||||
SoMFVec3f pnts;
|
||||
SoSFVec3f norm;
|
||||
SoSFBool strikethrough;
|
||||
SoSFImage image;
|
||||
SoSFFloat lineWidth;
|
||||
SoSFFloat sampling;
|
||||
|
||||
@@ -936,6 +936,7 @@ Restart:
|
||||
asciiText->string = SbString(
|
||||
getPresentationString(Constr, "◠ ").toUtf8().constData()
|
||||
);
|
||||
asciiText->strikethrough = !Constr->isActive;
|
||||
|
||||
asciiText->pnts.setNum(3);
|
||||
SbVec3f* verts = asciiText->pnts.startEditing();
|
||||
@@ -958,6 +959,7 @@ Restart:
|
||||
|
||||
// Get presentation string (w/o units if option is set)
|
||||
asciiText->string = SbString(getPresentationString(Constr).toUtf8().constData());
|
||||
asciiText->strikethrough = !Constr->isActive;
|
||||
|
||||
if (Constr->Type == Distance) {
|
||||
asciiText->datumtype = SoDatumLabel::DISTANCE;
|
||||
@@ -1468,6 +1470,7 @@ Restart:
|
||||
sep->getChild(static_cast<int>(ConstraintNodePosition::DatumLabelIndex))
|
||||
);
|
||||
asciiText->string = SbString(getPresentationString(Constr).toUtf8().constData());
|
||||
asciiText->strikethrough = !Constr->isActive;
|
||||
asciiText->datumtype = SoDatumLabel::ANGLE;
|
||||
asciiText->param1 = distance;
|
||||
asciiText->param2 = startangle;
|
||||
@@ -1543,6 +1546,7 @@ Restart:
|
||||
asciiText->string = SbString(
|
||||
getPresentationString(Constr, "⌀").toUtf8().constData()
|
||||
);
|
||||
asciiText->strikethrough = !Constr->isActive;
|
||||
|
||||
asciiText->datumtype = SoDatumLabel::DIAMETER;
|
||||
asciiText->param1 = Constr->LabelDistance;
|
||||
@@ -1625,6 +1629,7 @@ Restart:
|
||||
asciiText->string = SbString(
|
||||
getPresentationString(Constr, "R").toUtf8().constData()
|
||||
);
|
||||
asciiText->strikethrough = !Constr->isActive;
|
||||
}
|
||||
|
||||
asciiText->datumtype = SoDatumLabel::RADIUS;
|
||||
@@ -2166,14 +2171,6 @@ QString EditModeConstraintCoinManager::getPresentationString(
|
||||
fixedValueStr = QStringLiteral("(") + fixedValueStr + QStringLiteral(")");
|
||||
}
|
||||
|
||||
if (!constraint->isActive) {
|
||||
QString result = QStringLiteral("\u0336");
|
||||
for (auto c : std::as_const(fixedValueStr)) {
|
||||
result += c + QStringLiteral("\u0336");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return fixedValueStr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user