[TD]Allow transparent Faces as default
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -61,6 +61,8 @@ void DlgPrefsTechDrawImp::saveSettings()
|
||||
pcb_Surface->onSave();
|
||||
pcb_Background->onSave();
|
||||
pcb_Hatch->onSave();
|
||||
pcb_Face->onSave();
|
||||
pcb_PaintFaces->onSave(); //check box!
|
||||
|
||||
pfb_LabelFont->onSave();
|
||||
plsb_LabelSize->onSave();
|
||||
@@ -94,6 +96,8 @@ void DlgPrefsTechDrawImp::loadSettings()
|
||||
pcb_Surface->onRestore();
|
||||
pcb_Background->onRestore();
|
||||
pcb_Hatch->onRestore();
|
||||
pcb_Face->onRestore();
|
||||
pcb_PaintFaces->onRestore(); //check box!
|
||||
|
||||
pfb_LabelFont->onRestore();
|
||||
plsb_LabelSize->onRestore();
|
||||
|
||||
@@ -72,7 +72,7 @@ QGIFace::QGIFace(int index) :
|
||||
projIndex(index)
|
||||
{
|
||||
m_segCount = 0;
|
||||
setFillMode(NoFill);
|
||||
// setFillMode(NoFill);
|
||||
isHatched(false);
|
||||
setFlag(QGraphicsItem::ItemClipsChildrenToShape,true);
|
||||
|
||||
@@ -91,17 +91,23 @@ QGIFace::QGIFace(int index) :
|
||||
|
||||
m_svgCol = SVGCOLDEFAULT;
|
||||
m_fillScale = 1.0;
|
||||
|
||||
|
||||
m_colDefFill = Qt::white;
|
||||
m_styleDef = Qt::SolidPattern;
|
||||
m_styleSelect = Qt::SolidPattern;
|
||||
|
||||
getParameters();
|
||||
|
||||
m_styleNormal = m_styleDef;
|
||||
m_fillStyle = m_styleDef;
|
||||
m_fill = m_styleDef;
|
||||
m_colDefFill = Qt::white;
|
||||
m_colNormalFill = m_colDefFill;
|
||||
m_styleDef = Qt::SolidPattern;
|
||||
m_styleSelect = Qt::SolidPattern;
|
||||
|
||||
if (m_defClearFace) {
|
||||
setFillMode(NoFill);
|
||||
setFill(Qt::transparent, m_styleDef);
|
||||
} else {
|
||||
setFillMode(PlainFill);
|
||||
setFill(m_colNormalFill, m_styleDef);
|
||||
}
|
||||
}
|
||||
|
||||
QGIFace::~QGIFace()
|
||||
@@ -151,6 +157,10 @@ void QGIFace::draw()
|
||||
m_brush.setTexture(m_texture);
|
||||
}
|
||||
}
|
||||
} else if (m_mode == PlainFill) {
|
||||
if (!m_lineSets.empty()) {
|
||||
setFill(m_colNormalFill, m_styleNormal);
|
||||
}
|
||||
}
|
||||
}
|
||||
show();
|
||||
@@ -166,8 +176,7 @@ void QGIFace::setPrettyNormal() {
|
||||
m_fillStyle = m_styleNormal;
|
||||
m_fill = m_styleNormal;
|
||||
m_brush.setTexture(QPixmap());
|
||||
// m_brush.setStyle(m_fillStyle);
|
||||
m_brush.setStyle(m_fill); //???
|
||||
m_brush.setStyle(m_fill);
|
||||
m_fillColor = m_colNormalFill;
|
||||
}
|
||||
QGIPrimPath::setPrettyNormal();
|
||||
@@ -620,8 +629,16 @@ void QGIFace::getParameters(void)
|
||||
hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
m_maxTile = hGrp->GetInt("MaxSVGTile",10000l);
|
||||
}
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color temp = hGrp->GetUnsigned("FaceColor",0xffffffff);
|
||||
setFillColor(temp.asValue<QColor>());
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
m_defClearFace = hGrp->GetBool("ClearFace",false);
|
||||
}
|
||||
|
||||
QRectF QGIFace::boundingRect() const
|
||||
{
|
||||
@@ -638,9 +655,6 @@ void QGIFace::paint ( QPainter * painter, const QStyleOptionGraphicsItem * optio
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
// m_brush.setStyle(m_fillStyle);
|
||||
// m_brush.setColor(m_fillColor);
|
||||
// setBrush(m_brush);
|
||||
QGIPrimPath::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,11 +85,6 @@ public:
|
||||
bool isHatched(void) {return m_isHatched;}
|
||||
void setFillMode(fillMode m);
|
||||
|
||||
/* //plain color fill parms*/
|
||||
/* void setFill(QColor c, Qt::BrushStyle s);*/
|
||||
/* void setFill(QBrush b);*/
|
||||
/* void resetFill();*/
|
||||
|
||||
//general hatch parms & methods
|
||||
void setHatchColor(App::Color c);
|
||||
void setHatchScale(double s);
|
||||
@@ -151,16 +146,6 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
/* QBrush m_brush;*/
|
||||
/* Qt::BrushStyle m_fillStyle; //current fill style*/
|
||||
/* QColor m_fillColor; //current fill color*/
|
||||
|
||||
/* QColor m_colDefFill; //"no color" default normal fill color*/
|
||||
/* QColor m_colNormalFill; //current Normal fill color*/
|
||||
/* Qt::BrushStyle m_styleDef; //default Normal fill style*/
|
||||
/* Qt::BrushStyle m_styleNormal; //current Normal fill style*/
|
||||
/* Qt::BrushStyle m_styleSelect; //Select/preSelect fill style*/
|
||||
|
||||
QPixmap m_texture; //
|
||||
|
||||
QPainterPath m_outline; //
|
||||
@@ -169,6 +154,8 @@ private:
|
||||
|
||||
QColor m_geomColor; //color for crosshatch lines
|
||||
double m_geomWeight; //lineweight for crosshatch lines
|
||||
bool m_defClearFace;
|
||||
QColor m_defFaceColor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -138,9 +138,10 @@ void QGIPrimPath::setPrettySel() {
|
||||
update();
|
||||
}
|
||||
|
||||
//wf: why would a face use it's parent's normal colour?
|
||||
//this always goes to parameter
|
||||
QColor QGIPrimPath::getNormalColor()
|
||||
{
|
||||
|
||||
QColor result;
|
||||
QGIView *parent;
|
||||
|
||||
@@ -164,6 +165,7 @@ QColor QGIPrimPath::getNormalColor()
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -282,13 +284,13 @@ void QGIPrimPath::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
||||
}
|
||||
|
||||
void QGIPrimPath::setFill(QColor c, Qt::BrushStyle s) {
|
||||
m_colNormalFill = c;
|
||||
setFillColor(c);
|
||||
m_styleNormal = s;
|
||||
m_fill = s;
|
||||
}
|
||||
|
||||
void QGIPrimPath::setFill(QBrush b) {
|
||||
m_colNormalFill = b.color();
|
||||
setFillColor(b.color());
|
||||
m_styleNormal = b.style();
|
||||
m_fill = b.style();
|
||||
}
|
||||
@@ -299,6 +301,13 @@ void QGIPrimPath::resetFill() {
|
||||
m_fill = m_styleDef;
|
||||
}
|
||||
|
||||
void QGIPrimPath::setFillColor(QColor c)
|
||||
{
|
||||
m_colNormalFill = c;
|
||||
m_colDefFill = c;
|
||||
}
|
||||
|
||||
|
||||
void QGIPrimPath::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
@@ -308,7 +317,7 @@ void QGIPrimPath::paint ( QPainter * painter, const QStyleOptionGraphicsItem * o
|
||||
m_pen.setStyle(m_styleCurrent);
|
||||
setPen(m_pen);
|
||||
|
||||
m_brush.setColor(m_fillColor); //pencolr
|
||||
m_brush.setColor(m_colNormalFill);
|
||||
m_brush.setStyle(m_fill);
|
||||
setBrush(m_brush);
|
||||
|
||||
|
||||
@@ -58,15 +58,18 @@ public:
|
||||
void setStyle(int s);
|
||||
virtual void setNormalColor(QColor c);
|
||||
virtual void setCapStyle(Qt::PenCapStyle c);
|
||||
Qt::BrushStyle getFill() { return m_fill; }
|
||||
|
||||
//plain color fill parms
|
||||
void setFill(Qt::BrushStyle f) { m_fill = f; }
|
||||
Qt::BrushStyle getFill() { return m_fill; }
|
||||
|
||||
void setFill(QColor c, Qt::BrushStyle s);
|
||||
void setFill(QBrush b);
|
||||
void resetFill();
|
||||
void setFillColor(QColor c) { m_colNormalFill = c;
|
||||
m_colDefFill = c; }
|
||||
/* void setFillColor(QColor c) { m_colNormalFill = c;*/
|
||||
/* m_colDefFill = c; }*/
|
||||
void setFillColor(QColor c);
|
||||
QColor getFillColor(void) { return m_colDefFill; }
|
||||
|
||||
protected:
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
|
||||
@@ -372,6 +372,7 @@ void QGIViewPart::drawViewPart()
|
||||
QGIFace* newFace = drawFace(*fit,i);
|
||||
newFace->isHatched(false);
|
||||
newFace->setFillMode(QGIFace::PlainFill);
|
||||
// newFace->setFill(QColor(Qt::red), Qt::SolidPattern); //this overrides the QGIF defaults
|
||||
TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs);
|
||||
TechDraw::DrawGeomHatch* fGeom = faceIsGeomHatched(i,geomObjs);
|
||||
if (fGeom) {
|
||||
@@ -418,8 +419,8 @@ void QGIViewPart::drawViewPart()
|
||||
bool drawEdges = prefFaceEdges();
|
||||
newFace->setDrawEdges(drawEdges); //pref. for debugging only
|
||||
newFace->setZValue(ZVALUE::FACE);
|
||||
newFace->draw();
|
||||
newFace->setPrettyNormal();
|
||||
newFace->draw();
|
||||
}
|
||||
}
|
||||
#endif //#if MOD_TECHDRAW_HANDLE_FACES
|
||||
|
||||
Reference in New Issue
Block a user