[TD]resolve variable name confusion

QPen and QBrush variable names were too similar and
easily confused.
This commit is contained in:
wandererfan
2023-06-21 20:10:02 -04:00
committed by WandererFan
parent 4b80ea044d
commit 60531f384e
3 changed files with 29 additions and 26 deletions

View File

@@ -62,10 +62,12 @@ QGIFace::QGIFace(int index) :
isHatched(false);
setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
//setStyle(Qt::NoPen); //don't draw face lines, just fill for debugging
setStyle(Qt::DashLine);
setStyle(Qt::NoPen); //don't draw face lines, just fill for debugging
//setStyle(Qt::DashLine);
m_geomColor = PreferencesGui::getAccessibleQColor(QColor(Qt::black));
setLineWeight(0.5); //0 = cosmetic
m_styleCurrent = Qt::NoPen;
m_pen.setStyle(m_styleCurrent);
setLineWeight(0.0); //0 = cosmetic
setPrettyNormal();
m_texture = QPixmap(); //empty texture
@@ -82,19 +84,20 @@ QGIFace::QGIFace(int index) :
getParameters();
// set up style & colour defaults
m_styleDef = Qt::SolidPattern;
m_styleSelect = Qt::SolidPattern;
App::Color temp {static_cast<uint32_t>(Preferences::getPreferenceGroup("Colors")->GetUnsigned("FaceColor",0xffffffff))};
setFillColor(temp.asValue<QColor>());
m_colDefFill = temp.asValue<QColor>();
m_fillDef = Qt::SolidPattern;
m_fillSelect = Qt::SolidPattern;
if (m_defClearFace) {
setFillMode(NoFill);
m_colDefFill = Qt::transparent;
setFill(Qt::transparent, m_styleDef);
setFill(Qt::transparent, m_fillDef);
} else {
setFillMode(PlainFill);
setFill(m_colDefFill, m_styleDef);
m_colDefFill = Qt::white;
setFill(m_colDefFill, m_fillDef);
}
m_sharedRender = new QSvgRenderer();
@@ -108,6 +111,7 @@ QGIFace::~QGIFace()
/// redraw this face
void QGIFace::draw()
{
// Base::Console().Message("QGIF::draw - pen style: %d\n", m_pen.style());
setPath(m_outline); //Face boundary
if (isHatched()) {
@@ -116,8 +120,8 @@ void QGIFace::draw()
setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
if (!m_lineSets.empty()) {
m_brush.setTexture(QPixmap());
m_fillStyleCurrent = m_styleDef;
m_styleNormal = m_fillStyleCurrent;
m_fillStyleCurrent = m_fillDef;
m_fillNormal = m_fillStyleCurrent;
for (auto& ls: m_lineSets) {
lineSetToFillItems(ls);
}
@@ -126,8 +130,8 @@ void QGIFace::draw()
m_svgHatchArea->hide();
} else if (m_mode == SvgFill) {
m_brush.setTexture(QPixmap());
m_styleNormal = m_styleDef;
m_fillStyleCurrent = m_styleNormal;
m_fillNormal = m_fillDef;
m_fillStyleCurrent = m_fillNormal;
loadSvgHatch(m_fileSpec);
if (m_hideSvgTiles) {
//bitmap hatch doesn't need clipping
@@ -147,7 +151,7 @@ void QGIFace::draw()
m_texture = textureFromBitmap(m_fileSpec);
m_brush.setTexture(m_texture);
} else if (m_mode == PlainFill) {
setFill(m_colNormalFill, m_styleNormal);
setFill(m_colNormalFill, m_fillNormal);
m_imageHatchArea->hide();
m_svgHatchArea->hide();
}
@@ -189,6 +193,7 @@ void QGIFace::setPrettySel() {
/// show or hide the edges of this face. Usually just for debugging
void QGIFace::setDrawEdges(bool b) {
// Base::Console().Message("QGIF::setDrawEdges(%d)\n", b);
if (b) {
setStyle(Qt::DashLine);
} else {

View File

@@ -65,10 +65,10 @@ QGIPrimPath::QGIPrimPath():
m_pen.setCapStyle(m_capStyle);
m_pen.setWidthF(m_width);
m_styleDef = Qt::NoBrush;
m_styleSelect = Qt::SolidPattern;
m_styleNormal = m_styleDef;
m_fillStyleCurrent = m_styleNormal;
m_fillDef = Qt::NoBrush;
m_fillSelect = Qt::SolidPattern;
m_fillNormal = m_fillDef;
m_fillStyleCurrent = m_fillNormal;
m_colDefFill = Qt::white;
// m_colDefFill = Qt::transparent;
@@ -216,7 +216,6 @@ void QGIPrimPath::setStyle(int s)
m_styleCurrent = static_cast<Qt::PenStyle>(s);
}
void QGIPrimPath::setNormalColor(QColor c)
{
m_colNormal = c;
@@ -279,20 +278,20 @@ void QGIPrimPath::mousePressEvent(QGraphicsSceneMouseEvent * event)
void QGIPrimPath::setFill(QColor c, Qt::BrushStyle s) {
setFillColor(c);
m_styleNormal = s;
m_fillNormal = s;
m_fillStyleCurrent = s;
}
void QGIPrimPath::setFill(QBrush b) {
setFillColor(b.color());
m_styleNormal = b.style();
m_fillNormal = b.style();
m_fillStyleCurrent = b.style();
}
void QGIPrimPath::resetFill() {
m_colNormalFill = m_colDefFill;
m_styleNormal = m_styleDef;
m_fillStyleCurrent = m_styleDef;
m_fillNormal = m_fillDef;
m_fillStyleCurrent = m_fillDef;
}
//set PlainFill
@@ -303,14 +302,12 @@ void QGIPrimPath::setFillColor(QColor c)
// m_colDefFill = c;
}
void QGIPrimPath::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
QStyleOptionGraphicsItem myOption(*option);
myOption.state &= ~QStyle::State_Selected;
m_pen.setWidthF(m_width);
m_pen.setColor(m_colCurrent);
m_pen.setStyle(m_styleCurrent);
setPen(m_pen);
m_brush.setColor(m_fillColorCurrent);

View File

@@ -93,6 +93,7 @@ protected:
QColor m_colNormal;
bool m_colOverride;
Qt::PenStyle m_styleCurrent;
Qt::PenStyle m_styleNormal;
double m_width;
Qt::PenCapStyle m_capStyle;
@@ -102,9 +103,9 @@ protected:
QColor m_colDefFill; //"no color" default normal fill color
QColor m_colNormalFill; //current Normal fill color def or plain fill
Qt::BrushStyle m_styleDef; //default Normal fill style
Qt::BrushStyle m_styleNormal; //current Normal fill style
Qt::BrushStyle m_styleSelect; //Select/preSelect fill style
Qt::BrushStyle m_fillDef; //default Normal fill style
Qt::BrushStyle m_fillNormal; //current Normal fill style
Qt::BrushStyle m_fillSelect; //Select/preSelect fill style
bool m_fillOverride;