[TD]add light text on dark page mode
- some visually impaired users need white graphics on dark page. - revise Annotation dialog to respect dark style
This commit is contained in:
@@ -22,13 +22,13 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <cmath>
|
||||
#include <cmath>
|
||||
|
||||
# include <QGraphicsScene>
|
||||
# include <QGraphicsSceneMouseEvent>
|
||||
# include <QPainter>
|
||||
# include <QPainterPath>
|
||||
# include <QVector2D>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QVector2D>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
@@ -37,10 +37,10 @@
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
|
||||
#include "QGILeaderLine.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGEPath.h"
|
||||
#include "QGIArrow.h"
|
||||
#include "QGILeaderLine.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "Rez.h"
|
||||
#include "ViewProviderLeader.h"
|
||||
@@ -51,14 +51,14 @@ using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
//**************************************************************
|
||||
QGILeaderLine::QGILeaderLine() :
|
||||
m_parentItem(nullptr),
|
||||
m_lineColor(Qt::black),
|
||||
m_lineStyle(Qt::SolidLine),
|
||||
m_hasHover(false),
|
||||
m_saveX(0.0),
|
||||
m_saveY(0.0),
|
||||
m_blockDraw(false)
|
||||
QGILeaderLine::QGILeaderLine()
|
||||
: m_parentItem(nullptr),
|
||||
m_lineColor(Qt::black),
|
||||
m_lineStyle(Qt::SolidLine),
|
||||
m_hasHover(false),
|
||||
m_saveX(0.0),
|
||||
m_saveY(0.0),
|
||||
m_blockDraw(false)
|
||||
|
||||
{
|
||||
setHandlesChildEvents(false);
|
||||
@@ -96,16 +96,16 @@ QGILeaderLine::QGILeaderLine() :
|
||||
|
||||
setZValue(ZVALUE::DIMENSION);
|
||||
|
||||
QObject::connect(
|
||||
m_editPath, SIGNAL(pointsUpdated(QPointF, std::vector<QPointF>)),
|
||||
this , SLOT (onLineEditFinished(QPointF, std::vector<QPointF>))
|
||||
);
|
||||
QObject::connect(m_editPath,
|
||||
SIGNAL(pointsUpdated(QPointF, std::vector<QPointF>)),
|
||||
this,
|
||||
SLOT(onLineEditFinished(QPointF, std::vector<QPointF>)));
|
||||
}
|
||||
|
||||
void QGILeaderLine::setLeaderFeature(TechDraw::DrawLeaderLine* feat)
|
||||
{
|
||||
// Base::Console().Message("QGILL::setLeaderFeature()\n");
|
||||
setViewFeature(static_cast<TechDraw::DrawView *>(feat));
|
||||
// Base::Console().Message("QGILL::setLeaderFeature()\n");
|
||||
setViewFeature(static_cast<TechDraw::DrawView*>(feat));
|
||||
|
||||
float x = Rez::guiX(feat->X.getValue());
|
||||
float y = Rez::guiX(-feat->Y.getValue());
|
||||
@@ -117,39 +117,41 @@ void QGILeaderLine::setLeaderFeature(TechDraw::DrawLeaderLine* feat)
|
||||
updateView();
|
||||
}
|
||||
|
||||
QVariant QGILeaderLine::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
QVariant QGILeaderLine::itemChange(GraphicsItemChange change, const QVariant& value)
|
||||
{
|
||||
// Base::Console().Message("QGILL::itemChange(%d)\n", change);
|
||||
// Base::Console().Message("QGILL::itemChange(%d)\n", change);
|
||||
if (change == ItemSelectedHasChanged && scene()) {
|
||||
if(isSelected()) {
|
||||
if (isSelected()) {
|
||||
setPrettySel();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
setPrettyNormal();
|
||||
}
|
||||
draw();
|
||||
} else if(change == ItemSceneChange && scene()) {
|
||||
}
|
||||
else if (change == ItemSceneChange && scene()) {
|
||||
// nothing special!
|
||||
}
|
||||
return QGIView::itemChange(change, value);
|
||||
}
|
||||
|
||||
//QGILL isn't draggable so skip QGIV::mousePress have event
|
||||
void QGILeaderLine::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
||||
void QGILeaderLine::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
{
|
||||
// Base::Console().Message("QGILL::mousePressEvent() - %s\n", getViewName());
|
||||
// Base::Console().Message("QGILL::mousePressEvent() - %s\n", getViewName());
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//QGILL isn't draggable so skip QGIV::mouseRelease
|
||||
void QGILeaderLine::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
|
||||
void QGILeaderLine::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
|
||||
{
|
||||
// Base::Console().Message("QGILL::mouseReleaseEvent() - %s\n", getViewName());
|
||||
// Base::Console().Message("QGILL::mouseReleaseEvent() - %s\n", getViewName());
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void QGILeaderLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
void QGILeaderLine::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
|
||||
{
|
||||
// Base::Console().Message("QGILL::hoverEnter() - selected; %d\n", isSelected());
|
||||
// Base::Console().Message("QGILL::hoverEnter() - selected; %d\n", isSelected());
|
||||
m_hasHover = true;
|
||||
if (!isSelected()) {
|
||||
setPrettyPre();
|
||||
@@ -157,11 +159,11 @@ void QGILeaderLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
QGIView::hoverEnterEvent(event);
|
||||
}
|
||||
|
||||
void QGILeaderLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
void QGILeaderLine::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
|
||||
{
|
||||
// Base::Console().Message("QGILL::hoverLeave() - selected; %d\n", isSelected());
|
||||
// Base::Console().Message("QGILL::hoverLeave() - selected; %d\n", isSelected());
|
||||
m_hasHover = false;
|
||||
if(!isSelected()) {
|
||||
if (!isSelected()) {
|
||||
setPrettyNormal();
|
||||
}
|
||||
QGIView::hoverLeaveEvent(event);
|
||||
@@ -169,45 +171,51 @@ void QGILeaderLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
||||
void QGILeaderLine::onSourceChange(TechDraw::DrawView* newParent)
|
||||
{
|
||||
// Base::Console().Message("QGILL::onSoureChange(%s)\n", newParent->getNameInDocument());
|
||||
// Base::Console().Message("QGILL::onSoureChange(%s)\n", newParent->getNameInDocument());
|
||||
std::string parentName = newParent->getNameInDocument();
|
||||
QGIView* qgiParent = getQGIVByName(parentName);
|
||||
if (qgiParent) {
|
||||
m_parentItem = qgiParent;
|
||||
setParentItem(m_parentItem);
|
||||
draw();
|
||||
} else {
|
||||
Base::Console().Warning("QGILL::onSourceChange - new parent %s has no QGIView\n", parentName.c_str());
|
||||
}
|
||||
else {
|
||||
Base::Console().Warning("QGILL::onSourceChange - new parent %s has no QGIView\n",
|
||||
parentName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void QGILeaderLine::setNormalColorAll()
|
||||
{
|
||||
// Base::Console().Message("QGILL::setNormalColorAll - normal color: %s\n", qPrintable(getNormalColor().name()));
|
||||
m_line->setNormalColor(getNormalColor());
|
||||
m_editPath->setNormalColor(getNormalColor());
|
||||
m_arrow1->setNormalColor(getNormalColor());
|
||||
m_arrow1->setFillColor(getNormalColor());
|
||||
m_arrow2->setNormalColor(getNormalColor());
|
||||
m_arrow2->setFillColor(getNormalColor());
|
||||
// Base::Console().Message("QGILL::setNormalColorAll - normal color: %s\n", qPrintable(getNormalColor().name()));
|
||||
QColor qc = prefNormalColor();
|
||||
m_line->setNormalColor(qc);
|
||||
m_editPath->setNormalColor(qc);
|
||||
m_arrow1->setNormalColor(qc);
|
||||
m_arrow1->setFillColor(qc);
|
||||
m_arrow2->setNormalColor(qc);
|
||||
m_arrow2->setFillColor(qc);
|
||||
}
|
||||
|
||||
void QGILeaderLine::setPrettyNormal() {
|
||||
// Base::Console().Message("QGILL::setPrettyNormal()\n");
|
||||
void QGILeaderLine::setPrettyNormal()
|
||||
{
|
||||
// Base::Console().Message("QGILL::setPrettyNormal()\n");
|
||||
m_line->setPrettyNormal();
|
||||
m_arrow1->setPrettyNormal();
|
||||
m_arrow2->setPrettyNormal();
|
||||
}
|
||||
|
||||
void QGILeaderLine::setPrettyPre() {
|
||||
// Base::Console().Message("QGILL::setPrettyPre()\n");
|
||||
void QGILeaderLine::setPrettyPre()
|
||||
{
|
||||
// Base::Console().Message("QGILL::setPrettyPre()\n");
|
||||
m_line->setPrettyPre();
|
||||
m_arrow1->setPrettyPre();
|
||||
m_arrow2->setPrettyPre();
|
||||
}
|
||||
|
||||
void QGILeaderLine::setPrettySel() {
|
||||
// Base::Console().Message("QGILL::setPrettySel()\n");
|
||||
void QGILeaderLine::setPrettySel()
|
||||
{
|
||||
// Base::Console().Message("QGILL::setPrettySel()\n");
|
||||
m_line->setPrettySel();
|
||||
m_arrow1->setPrettySel();
|
||||
m_arrow2->setPrettySel();
|
||||
@@ -216,36 +224,35 @@ void QGILeaderLine::setPrettySel() {
|
||||
|
||||
void QGILeaderLine::closeEdit()
|
||||
{
|
||||
// Base::Console().Message("QGIL::closeEdit()\n");
|
||||
// Base::Console().Message("QGIL::closeEdit()\n");
|
||||
if (m_editPath) {
|
||||
m_editPath->onEndEdit(); //tell QEPath that edit session ended
|
||||
m_editPath->onEndEdit();//tell QEPath that edit session ended
|
||||
}
|
||||
}
|
||||
|
||||
//signaled from QEPath
|
||||
void QGILeaderLine::onLineEditFinished(QPointF tipDisplace, std::vector<QPointF> points)
|
||||
{
|
||||
// Base::Console().Message("QGILL::onLineEditFinished(%s, %d)\n",
|
||||
// TechDraw::DrawUtil::formatVector(tipDisplace).c_str(),
|
||||
// points.size());
|
||||
// Base::Console().Message("QGILL::onLineEditFinished(%s, %d)\n",
|
||||
// TechDraw::DrawUtil::formatVector(tipDisplace).c_str(),
|
||||
// points.size());
|
||||
m_blockDraw = true;
|
||||
auto featLeader = getFeature();
|
||||
if (!featLeader)
|
||||
if (!featLeader) {
|
||||
return;
|
||||
}
|
||||
double baseScale = featLeader->getBaseScale();
|
||||
|
||||
if ( !(TechDraw::DrawUtil::fpCompare(tipDisplace.x(), 0.0) &&
|
||||
TechDraw::DrawUtil::fpCompare(tipDisplace.y(), 0.0)) ) {
|
||||
if (!(TechDraw::DrawUtil::fpCompare(tipDisplace.x(), 0.0)
|
||||
&& TechDraw::DrawUtil::fpCompare(tipDisplace.y(), 0.0))) {
|
||||
//tip was moved. need to change AttachPoint
|
||||
QPointF oldAttach = getAttachFromFeature();
|
||||
QPointF newAttach = oldAttach + (tipDisplace / baseScale);
|
||||
featLeader->setPosition(Rez::appX(newAttach.x()),
|
||||
Rez::appX(- newAttach.y()),
|
||||
true);
|
||||
featLeader->setPosition(Rez::appX(newAttach.x()), Rez::appX(-newAttach.y()), true);
|
||||
}
|
||||
|
||||
std::vector<Base::Vector3d> waypoints;
|
||||
for (auto& p: points) {
|
||||
for (auto& p : points) {
|
||||
QPointF moved = p - tipDisplace;
|
||||
Base::Vector3d v(moved.x(), moved.y(), 0.0);
|
||||
waypoints.push_back(v);
|
||||
@@ -257,7 +264,7 @@ void QGILeaderLine::onLineEditFinished(QPointF tipDisplace, std::vector<QPointF>
|
||||
featLeader->adjustLastSegment();
|
||||
}
|
||||
|
||||
Q_EMIT editComplete(); //tell task editing is complete
|
||||
Q_EMIT editComplete();//tell task editing is complete
|
||||
|
||||
m_blockDraw = false;
|
||||
m_editPath->hide();
|
||||
@@ -267,9 +274,10 @@ void QGILeaderLine::onLineEditFinished(QPointF tipDisplace, std::vector<QPointF>
|
||||
void QGILeaderLine::startPathEdit()
|
||||
{
|
||||
saveState();
|
||||
auto featLeader( dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()) );
|
||||
if (!featLeader)
|
||||
auto featLeader(dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()));
|
||||
if (!featLeader) {
|
||||
return;
|
||||
}
|
||||
|
||||
double scale = featLeader->getScale();
|
||||
m_editPath->setScale(scale);
|
||||
@@ -280,7 +288,7 @@ void QGILeaderLine::startPathEdit()
|
||||
|
||||
void QGILeaderLine::saveState()
|
||||
{
|
||||
// Base::Console().Message("QGILL::saveState()\n");
|
||||
// Base::Console().Message("QGILL::saveState()\n");
|
||||
auto featLeader = getFeature();
|
||||
if (featLeader) {
|
||||
m_savePoints = featLeader->WayPoints.getValues();
|
||||
@@ -291,7 +299,7 @@ void QGILeaderLine::saveState()
|
||||
|
||||
void QGILeaderLine::restoreState()
|
||||
{
|
||||
// Base::Console().Message("QGILL::restoreState()\n");
|
||||
// Base::Console().Message("QGILL::restoreState()\n");
|
||||
auto featLeader = getFeature();
|
||||
if (featLeader) {
|
||||
featLeader->WayPoints.setValues(m_savePoints);
|
||||
@@ -305,52 +313,61 @@ void QGILeaderLine::restoreState()
|
||||
|
||||
void QGILeaderLine::updateView(bool update)
|
||||
{
|
||||
// Base::Console().Message("QGIL::updateView() %s\n", getViewObject()->getNameInDocument());
|
||||
// Base::Console().Message("QGIL::updateView() %s\n", getViewObject()->getNameInDocument());
|
||||
Q_UNUSED(update);
|
||||
auto featLeader( dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()) );
|
||||
auto featLeader(dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()));
|
||||
if (!featLeader) {
|
||||
Base::Console().Warning("QGILL::updateView - no feature!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
||||
if (!vp)
|
||||
if (!vp) {
|
||||
return;
|
||||
}
|
||||
draw();
|
||||
}
|
||||
|
||||
void QGILeaderLine::draw()
|
||||
{
|
||||
// Base::Console().Message("QGILL::draw()- %s\n", getViewObject()->getNameInDocument());
|
||||
if (m_blockDraw)
|
||||
// Base::Console().Message("QGILL::draw()- %s\n", getViewObject()->getNameInDocument());
|
||||
if (m_blockDraw) {
|
||||
return;
|
||||
if (!isVisible())
|
||||
}
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
||||
if (!featLeader)
|
||||
if (!featLeader) {
|
||||
return;
|
||||
}
|
||||
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
||||
if (!vp)
|
||||
if (!vp) {
|
||||
return;
|
||||
}
|
||||
|
||||
double scale = 1.0;
|
||||
TechDraw::DrawView* parent = featLeader->getBaseView();
|
||||
if (parent)
|
||||
if (parent) {
|
||||
scale = parent->getScale();
|
||||
}
|
||||
|
||||
if (m_editPath->inEdit())
|
||||
if (m_editPath->inEdit()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//********
|
||||
if (featLeader->isLocked())
|
||||
//********
|
||||
if (featLeader->isLocked()) {
|
||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
else
|
||||
}
|
||||
else {
|
||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
}
|
||||
|
||||
m_lineStyle = static_cast<Qt::PenStyle>(vp->LineStyle.getValue());
|
||||
double baseScale = featLeader->getBaseScale();
|
||||
double x = Rez::guiX(featLeader->X.getValue());
|
||||
double y = - Rez::guiX(featLeader->Y.getValue());
|
||||
double y = -Rez::guiX(featLeader->Y.getValue());
|
||||
QPointF aPoint(x, y);
|
||||
aPoint *= baseScale;
|
||||
setPos(aPoint);
|
||||
@@ -359,7 +376,7 @@ void QGILeaderLine::draw()
|
||||
m_line->setStyle(m_lineStyle);
|
||||
m_line->setWidth(getLineWidth());
|
||||
|
||||
m_line->setPos(0, 0); //make m_line coords == leader coords
|
||||
m_line->setPos(0, 0);//make m_line coords == leader coords
|
||||
|
||||
std::vector<QPointF> qPoints = getWayPointsFromFeature();
|
||||
if (featLeader->Scalable.getValue()) {
|
||||
@@ -374,9 +391,11 @@ void QGILeaderLine::draw()
|
||||
|
||||
if (isSelected()) {
|
||||
setPrettySel();
|
||||
} else if (m_hasHover) {
|
||||
}
|
||||
else if (m_hasHover) {
|
||||
setPrettyPre();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
setPrettyNormal();
|
||||
}
|
||||
update(boundingRect());
|
||||
@@ -384,23 +403,23 @@ void QGILeaderLine::draw()
|
||||
|
||||
QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
||||
{
|
||||
// Base::Console().Message("QGILeaderLine::makeLeaderPath()\n");
|
||||
// Base::Console().Message("QGILeaderLine::makeLeaderPath()\n");
|
||||
QPainterPath result;
|
||||
DrawLeaderLine* featLeader = getFeature();
|
||||
if (!featLeader) {
|
||||
Base::Console().Message("QGILL::makeLeaderPath - featLeader is nullptr\n");
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
QPointF startAdjVec(0.0, 0.0);
|
||||
double startAdjLength(0.0);
|
||||
double startAdjLength(0.0);
|
||||
QPointF endAdjVec(0.0, 0.0);
|
||||
double endAdjLength(0.0);
|
||||
double endAdjLength(0.0);
|
||||
if (qPoints.size() > 1) {
|
||||
//make path adjustment to hide leaderline ends behind arrowheads
|
||||
if (featLeader->StartSymbol.getValue() != ArrowType::NONE) {
|
||||
startAdjLength = QGIArrow::getOverlapAdjust(featLeader->StartSymbol.getValue(),
|
||||
QGIArrow::getPrefArrowSize());
|
||||
QGIArrow::getPrefArrowSize());
|
||||
}
|
||||
if (featLeader->EndSymbol.getValue() != ArrowType::NONE) {
|
||||
endAdjLength = QGIArrow::getOverlapAdjust(featLeader->EndSymbol.getValue(),
|
||||
@@ -409,7 +428,7 @@ QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
||||
|
||||
//get adjustment directions
|
||||
startAdjVec = qPoints.at(1) - qPoints.front();
|
||||
endAdjVec = (*(qPoints.end() - 2))- qPoints.back();
|
||||
endAdjVec = (*(qPoints.end() - 2)) - qPoints.back();
|
||||
|
||||
//get adjustment vectors
|
||||
QVector2D startTemp(startAdjVec);
|
||||
@@ -420,26 +439,26 @@ QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
||||
endAdjVec = endTemp.toPointF() * endAdjLength;
|
||||
|
||||
qPoints.front() += startAdjVec;
|
||||
qPoints.back() += endAdjVec;
|
||||
qPoints.back() += endAdjVec;
|
||||
result.moveTo(qPoints.front());
|
||||
for (int i = 1; i < (int)qPoints.size(); i++) {
|
||||
result.lineTo(qPoints.at(i));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QPointF QGILeaderLine::getAttachFromFeature()
|
||||
{
|
||||
// Base::Console().Message("QGILL::getAttachFromFeature()\n");
|
||||
// Base::Console().Message("QGILL::getAttachFromFeature()\n");
|
||||
QPointF result;
|
||||
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
||||
if((!featLeader) ) {
|
||||
if ((!featLeader)) {
|
||||
Base::Console().Message("QGIL::getAttachFromLeader - no feature\n");
|
||||
return result;
|
||||
}
|
||||
double x = Rez::guiX(featLeader->X.getValue());
|
||||
double y = - Rez::guiX(featLeader->Y.getValue());
|
||||
double y = -Rez::guiX(featLeader->Y.getValue());
|
||||
result = QPointF(x, y);
|
||||
return result;
|
||||
}
|
||||
@@ -451,11 +470,11 @@ std::vector<QPointF> QGILeaderLine::getWayPointsFromFeature()
|
||||
DrawLeaderLine* featLeader = getFeature();
|
||||
if (!featLeader) {
|
||||
Base::Console().Message("QGILL::getWayPointsFromFeature - featLeader is nullptr\n");
|
||||
return qPoints;
|
||||
return qPoints;
|
||||
}
|
||||
|
||||
std::vector<Base::Vector3d> vPoints = featLeader->WayPoints.getValues();
|
||||
for (auto& d: vPoints) {
|
||||
for (auto& d : vPoints) {
|
||||
QPointF temp(d.x, d.y);
|
||||
qPoints.push_back(temp);
|
||||
}
|
||||
@@ -467,7 +486,7 @@ std::vector<QPointF> QGILeaderLine::getWayPointsFromFeature()
|
||||
|
||||
void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
||||
{
|
||||
// Base::Console().Message("QGILL::setArrows()\n");
|
||||
// Base::Console().Message("QGILL::setArrows()\n");
|
||||
Base::Vector3d stdX(1.0, 0.0, 0.0);
|
||||
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
||||
|
||||
@@ -476,7 +495,7 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
||||
if (featLeader->StartSymbol.getValue() != ArrowType::NONE) {
|
||||
m_arrow1->setStyle(featLeader->StartSymbol.getValue());
|
||||
m_arrow1->setWidth(getLineWidth());
|
||||
// TODO: variable size arrow heads
|
||||
// TODO: variable size arrow heads
|
||||
m_arrow1->setSize(QGIArrow::getPrefArrowSize());
|
||||
m_arrow1->setDirMode(true);
|
||||
m_arrow1->setDirection(stdX);
|
||||
@@ -491,7 +510,8 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
||||
}
|
||||
m_arrow1->draw();
|
||||
m_arrow1->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_arrow1->hide();
|
||||
}
|
||||
|
||||
@@ -511,15 +531,16 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
||||
}
|
||||
m_arrow2->draw();
|
||||
m_arrow2->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_arrow2->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void QGILeaderLine::drawBorder()
|
||||
{
|
||||
////Leaders have no border!
|
||||
// QGIView::drawBorder(); //good for debugging
|
||||
////Leaders have no border!
|
||||
// QGIView::drawBorder(); //good for debugging
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
@@ -527,7 +548,7 @@ void QGILeaderLine::drawBorder()
|
||||
|
||||
void QGILeaderLine::abandonEdit()
|
||||
{
|
||||
// Base::Console().Message("QGIL::abandonEdit()\n");
|
||||
// Base::Console().Message("QGIL::abandonEdit()\n");
|
||||
m_editPath->clearMarkers();
|
||||
m_editPath->hide();
|
||||
restoreState();
|
||||
@@ -536,15 +557,15 @@ void QGILeaderLine::abandonEdit()
|
||||
double QGILeaderLine::getLineWidth()
|
||||
{
|
||||
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
||||
if (!vp)
|
||||
if (!vp) {
|
||||
return Rez::guiX(LineGroup::getDefaultWidth("Graphic"));
|
||||
}
|
||||
return Rez::guiX(vp->LineWidth.getValue());
|
||||
}
|
||||
|
||||
TechDraw::DrawLeaderLine* QGILeaderLine::getFeature()
|
||||
{
|
||||
TechDraw::DrawLeaderLine* result =
|
||||
static_cast<TechDraw::DrawLeaderLine*>(getViewObject());
|
||||
TechDraw::DrawLeaderLine* result = static_cast<TechDraw::DrawLeaderLine*>(getViewObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -555,12 +576,13 @@ double QGILeaderLine::getEdgeFuzz() const
|
||||
|
||||
QColor QGILeaderLine::prefNormalColor()
|
||||
{
|
||||
// Base::Console().Message("QGILL::getNormalColor()\n");
|
||||
// Base::Console().Message("QGILL::getNormalColor()\n");
|
||||
setNormalColor(PreferencesGui::leaderQColor());
|
||||
|
||||
auto vp = dynamic_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
||||
if (vp) {
|
||||
setNormalColor(vp->Color.getValue().asValue<QColor>());
|
||||
QColor normal = vp->Color.getValue().asValue<QColor>();
|
||||
setNormalColor(PreferencesGui::getAccessibleQColor(normal));
|
||||
}
|
||||
return getNormalColor();
|
||||
}
|
||||
@@ -570,14 +592,16 @@ QRectF QGILeaderLine::boundingRect() const
|
||||
return childrenBoundingRect();
|
||||
}
|
||||
|
||||
void QGILeaderLine::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
void QGILeaderLine::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||
QWidget* widget)
|
||||
{
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
// painter->setPen(Qt::blue);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
// painter->setPen(Qt::blue);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
QGIView::paint (painter, &myOption, widget);
|
||||
QGIView::paint(painter, &myOption, widget);
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_QGILeaderLine.cpp>
|
||||
|
||||
Reference in New Issue
Block a user