void ArrowMarker::setStyle(Qt::PenStyle style) { if (linePen().style() == style) return; QPen pen = linePen(); pen.setStyle(style); setLinePen(pen); }
void ArrowMarker::setWidth(int w) { if (linePen().width() == w) return; QPen pen = linePen(); pen.setWidth(w); setLinePen(pen); }
void ArrowMarker::setColor(const QColor &c) { if (linePen().color() == c) return; QPen pen = linePen(); pen.setColor(c); setLinePen(pen); }
const Style *DefaultStyleEngine::applyObjectStyle(const Style *baseStyle, StyleEngine::ElementType elementType, const ObjectVisuals &objectVisuals, const StyleEngine::Parameters *parameters) { ObjectStyleKey key(elementType, objectVisuals); const Style *derivedStyle = m_objectStyleMap.value(key); if (!derivedStyle) { int lineWidth = 1; QColor fillColor = DefaultStyleEngine::fillColor(elementType, objectVisuals); QColor lineColor = DefaultStyleEngine::lineColor(elementType, objectVisuals); QColor textColor = DefaultStyleEngine::textColor(elementType, objectVisuals); QFont normalFont = baseStyle->normalFont(); QFont headerFont = baseStyle->normalFont(); if (objectVisuals.isEmphasized()) { lineWidth = 2; headerFont.setBold(true); } auto style = new Style(baseStyle->type()); QPen linePen = baseStyle->linePen(); linePen.setColor(lineColor); linePen.setWidth(lineWidth); style->setLinePen(linePen); style->setInnerLinePen(linePen); style->setOuterLinePen(linePen); style->setExtraLinePen(linePen); style->setTextBrush(QBrush(textColor)); if (objectVisuals.visualSecondaryRole() == DObject::SecondaryRoleOutline) { style->setFillBrush(QBrush(Qt::white)); } else { if (!parameters->suppressGradients()) { QLinearGradient fillGradient(0.0, 0.0, 0.0, 1.0); fillGradient.setCoordinateMode(QGradient::ObjectBoundingMode); fillGradient.setColorAt(0.0, fillColor.lighter(110)); fillGradient.setColorAt(1.0, fillColor.darker(110)); style->setFillBrush(QBrush(fillGradient)); } else { style->setFillBrush(QBrush(fillColor)); } } if (objectVisuals.visualSecondaryRole() == DObject::SecondaryRoleOutline) style->setExtraFillBrush(QBrush(Qt::white)); else style->setExtraFillBrush(QBrush(fillColor.darker(120))); style->setNormalFont(normalFont); style->setSmallFont(baseStyle->smallFont()); style->setHeaderFont(headerFont); m_objectStyleMap.insert(key, style); derivedStyle = style; } return derivedStyle; }
PlotZozMarker::PlotZozMarker(const int LineStyle) { if (QwtPlotMarker::VLine == LineStyle) { setLineStyle( QwtPlotMarker::VLine ); setLabelAlignment( Qt::AlignLeft | Qt::AlignTop ); } else if (QwtPlotMarker::HLine == LineStyle) { setLineStyle( QwtPlotMarker::HLine ); setLabelAlignment(Qt::AlignRight | Qt::AlignTop); } setLinePen( Qt::red, 1, Qt::DotLine ); }
/*! Build and assign a line pen In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it non cosmetic ( see QPen::isCosmetic() ). This method has been introduced to hide this incompatibility. \param color Pen color \param width Pen width \param style Pen style \sa pen(), brush() */ void QwtPlotMarker::setLinePen( const QColor &color, qreal width, Qt::PenStyle style ) { setLinePen( QPen( color, width, style ) ); }