示例#1
0
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 );
}
示例#2
0
    void Ellipse::setProperty(QString &xml)
    {
        QDomDocument doc("xml");
        if (!doc.setContent(xml, false))
            return;

        QDomElement root = doc.documentElement();
        if (root.tagName() != "property")
            return;

        QDomNode n = root.firstChild();
        while (!n.isNull()) {
            QDomElement e = n.toElement();
            QString tagName = e.tagName();

            if (tagName == "border-width")
                setBorderWidth(e.text().toDouble());
            if (tagName == "border-color")
                setBorderColor(Color(e.text()));
            if (tagName == "inner-color")
                setInnerColor(Color(e.text()));

            if (tagName == "show-background")
                setShowBackground(e.text().toInt());
            if (tagName == "aspect-type")
                setAspectType((Ellipse::AspectType)e.text().toInt());
            if (tagName == "line-style")
                setLineStyle((GraphLib::LineStyle)e.text().toInt());
            if (tagName == "dash-length")
                setDashLength(e.text().toDouble());

            n = n.nextSibling();
        }
    }
示例#3
0
bool Volta::setProperty(P_ID propertyId, const QVariant& val)
      {
      switch (propertyId) {
            case P_ID::VOLTA_TYPE:
                  setVoltaType(Type(val.toInt()));
                  break;
            case P_ID::VOLTA_ENDING:
                  setEndings(val.value<QList<int>>());
                  break;
            case P_ID::LINE_WIDTH:
                  lineWidthStyle = PropertyStyle::UNSTYLED;
                  setLineWidth(val.value<Spatium>());
                  break;
            case P_ID::LINE_STYLE:
                  lineStyleStyle = PropertyStyle::UNSTYLED;
                  setLineStyle(Qt::PenStyle(val.toInt()));
                  break;
            default:
                  if (!TextLineBase::setProperty(propertyId, val))
                        return false;
                  break;
            }
      triggerLayout();
      return true;
      }
示例#4
0
void Ottava::resetProperty(P_ID id)
      {
      switch (id) {
            case P_ID::OTTAVA_TYPE:
                  return;

            case P_ID::LINE_WIDTH:
                  setLineWidth(score()->styleS(StyleIdx::ottavaLineWidth));
                  lineWidthStyle = PropertyStyle::STYLED;
                  break;

            case P_ID::LINE_STYLE:
                  setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::ottavaLineStyle)));
                  lineStyleStyle = PropertyStyle::STYLED;
                  break;

            case P_ID::NUMBERS_ONLY:
                  setNumbersOnly(score()->styleB(StyleIdx::ottavaNumbersOnly));
                  numbersOnlyStyle = PropertyStyle::STYLED;
                  setOttavaType(_ottavaType);
                  break;

            default:
                  return TextLine::resetProperty(id);
            }
      }
示例#5
0
void Volta::styleChanged()
      {
      if (lineWidthStyle == PropertyStyle::STYLED)
            setLineWidth(score()->styleS(StyleIdx::voltaLineWidth));
      if (lineStyleStyle == PropertyStyle::STYLED)
            setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::voltaLineStyle)));
      }
示例#6
0
caGraphics::caGraphics( QWidget *parent) :  QWidget(parent)
{
    QSizePolicy policy( QSizePolicy::Preferred, QSizePolicy::Preferred );
    policy.setHeightForWidth( true );
    setSizePolicy( policy );
    thisChannelA="";
    thisChannelB="";
    thisChannelC="";
    thisChannelD="";
    setForm(Rectangle);
    thisLineSize = 1;
    thisLineColor = Qt::black;
    thisForeColor = Qt::black;

    thisLineColorOld = QColor(255, 254, 253);
    thisForeColorOld = QColor(255, 254, 253);

    thisColorMode = Static;
    thisVisibility = StaticV;
    thisArrowSize=10;
    thisFillStyle = Outline;

    thisTiltAngle = 0;
    thisStartAngle = 0;
    thisSpanAngle = 90;

    setLineStyle(Solid);
    setHide(false);

    setAttribute(Qt::WA_TranslucentBackground, true);
    setWindowFlags(Qt::FramelessWindowHint);
}
示例#7
0
void Ottava::read(XmlReader& e)
      {
      qDeleteAll(spannerSegments());
      spannerSegments().clear();
      e.addSpanner(e.intAttribute("id", -1), this);
      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "subtype") {
                  QString s = e.readElementText();
                  bool ok;
                  int idx = s.toInt(&ok);
                  if (!ok) {
                        idx = int(Type::OTTAVA_8VA);
                        for (unsigned i = 0; i < sizeof(ottavaDefault)/sizeof(*ottavaDefault); ++i) {
                              if (s == ottavaDefault[i].name) {
                                    idx = i;
                                    break;
                                    }
                              }
                        }
                  else if (score()->mscVersion() <= 114) {
                        //subtype are now in a different order...
                        if (idx == 1)
                              idx = 2;
                        else if (idx == 2)
                              idx = 1;
                        }
                  setOttavaType(Type(idx));
                  }
            else if (tag == "numbersOnly") {
                  _numbersOnly = e.readInt();
                  numbersOnlyStyle = PropertyStyle::UNSTYLED;
                  }
            else if (tag == "lineWidth") {
                  setLineWidth(Spatium(e.readDouble()));
                  lineWidthStyle = PropertyStyle::UNSTYLED;
                  }
            else if (tag == "lineStyle") {
                  setLineStyle(Qt::PenStyle(e.readInt()));
                  lineStyleStyle = PropertyStyle::UNSTYLED;
                  }
            else if (tag == "beginSymbol") {                      // obsolete
                  beginTextStyle = PropertyStyle::UNSTYLED;
                  QString text(e.readElementText());
                  setBeginText(QString("<sym>%1</sym>").arg(text[0].isNumber() ? Sym::id2name(SymId(text.toInt())) : text));
                  }
            else if (tag == "continueSymbol") {                   // obsolete
                  continueTextStyle = PropertyStyle::UNSTYLED;
                  QString text(e.readElementText());
                  setContinueText(QString("<sym>%1</sym>").arg(text[0].isNumber() ? Sym::id2name(SymId(text.toInt())) : text));
                  }
            else if (!TextLine::readProperties(e))
                  e.unknown();
            }
      if (beginText() != propertyDefault(P_ID::BEGIN_TEXT))
            beginTextStyle = PropertyStyle::UNSTYLED;
      if (continueText() != propertyDefault(P_ID::CONTINUE_TEXT))
            continueTextStyle = PropertyStyle::UNSTYLED;
      }
示例#8
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::resetAppearance()
{
    setColor(cvf::Color3f(cvf::Color3::BLACK));
    setLineThickness(2);
    setLineStyle(STYLE_SOLID);
    setSymbol(SYMBOL_NONE);
    setSymbolSkipDinstance(10);
}
示例#9
0
Pedal::Pedal(Score* s)
   : TextLineBase(s)
      {
//      setBeginHookHeight(Spatium(-1.2));
//      setEndHookHeight(Spatium(-1.2));

      setLineWidth(score()->styleS(StyleIdx::pedalLineWidth));
      setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::pedalLineStyle)));
      }
示例#10
0
Ottava::Ottava(Score* s)
   : TextLine(s)
      {
      _numbersOnly        = score()->styleB(StyleIdx::ottavaNumbersOnly);
      setOttavaType(Type::OTTAVA_8VA);
      setLineWidth(score()->styleS(StyleIdx::ottavaLineWidth));
      setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::ottavaLineStyle)));
      setFlag(ElementFlag::ON_STAFF, true);
      }
示例#11
0
void scigraphics::drawer::eraseRectangle( const wrectangle& Rectangle )
{
  color Color = color::White;
  brushStyle BrushStyle( Color );
  lineStyle LineStyle( Color );

  setBrushStyle( BrushStyle );
  setLineStyle( LineStyle );
  drawRectangle( Rectangle ); 
}
示例#12
0
void Ottava::styleChanged()
      {
      if (lineWidthStyle == PropertyStyle::STYLED)
            setLineWidth(score()->styleS(StyleIdx::ottavaLineWidth));
      if (lineStyleStyle == PropertyStyle::STYLED)
            setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::ottavaLineStyle)));
      if (numbersOnlyStyle == PropertyStyle::STYLED)
            setNumbersOnly(score()->styleB(StyleIdx::ottavaNumbersOnly));
      setOttavaType(_ottavaType);
      }
示例#13
0
Ottava::Ottava(Score* s)
   : TextLine(s)
      {
      _numbersOnly   = false;
      numbersOnlyStyle = PropertyStyle::STYLED;
      setOttavaType(OttavaType::OTTAVA_8VA);
      setLineWidth(score()->styleS(ST_ottavaLineWidth));
      lineWidthStyle = PropertyStyle::STYLED;
      setLineStyle(Qt::PenStyle(score()->styleI(ST_ottavaLineStyle)));
      lineStyleStyle = PropertyStyle::STYLED;
      }
示例#14
0
Pedal::Pedal(Score* s)
   : TextLine(s)
      {
      setBeginHookHeight(Spatium(-1.2));
      setEndHookHeight(Spatium(-1.2));

      setLineWidth(score()->styleS(StyleIdx::pedalLineWidth));
      lineWidthStyle = PropertyStyle::STYLED;
      setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::pedalLineStyle)));
      lineStyleStyle = PropertyStyle::STYLED;
      }
示例#15
0
//-----------------------------------------------------------------------------
void CDrawContext::init ()
{
	// set the default values
	setFrameColor (kWhiteCColor);
	setLineStyle (kLineSolid);
	setLineWidth (1);
	setFillColor (kBlackCColor);
	setFontColor (kWhiteCColor);
	setFont (kSystemFont);
	setDrawMode (kAliasing);
	setClipRect (surfaceRect);
}
示例#16
0
Ottava::Ottava(Score* s)
   : TextLine(s)
      {
      _numbersOnly        = score()->styleB(StyleIdx::ottavaNumbersOnly);
      numbersOnlyStyle    = PropertyStyle::STYLED;
      beginTextStyle      = PropertyStyle::STYLED;
      continueTextStyle   = PropertyStyle::STYLED;
      setOttavaType(OttavaType::OTTAVA_8VA);
      setLineWidth(score()->styleS(StyleIdx::ottavaLineWidth));
      lineWidthStyle = PropertyStyle::STYLED;
      setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::ottavaLineStyle)));
      lineStyleStyle = PropertyStyle::STYLED;
      }
示例#17
0
void Hairpin::setHairpinType(Type val)
      {
      if (_hairpinType == val)
            return;
      _hairpinType = val;
      switch (_hairpinType) {
            case Type::CRESC_HAIRPIN:
            case Type::DECRESC_HAIRPIN:
                  setBeginText("");
                  setContinueText("");
                  setLineStyle(Qt::SolidLine);
                  break;
            case Type::CRESC_LINE:
                  setBeginText("cresc.");
                  setContinueText("(cresc.)");
                  setLineStyle(Qt::CustomDashLine);
                  break;
            case Type::DECRESC_LINE:
                  setBeginText("dim.");
                  setContinueText("(dim.)");
                  setLineStyle(Qt::CustomDashLine);
                  break;
            };
      }
示例#18
0
QgsRubberBand::QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon )
    : QgsMapCanvasItem( mapCanvas )
    , mIconSize( 5 )
    , mIconType( ICON_CIRCLE )
    , mTranslationOffsetX( 0.0 )
    , mTranslationOffsetY( 0.0 )
{
  reset( isPolygon ? QGis::Polygon : QGis::Line );
  QColor color( Qt::lightGray );
  color.setAlpha( 63 );
  setColor( color );
  setWidth( 1 );
  setLineStyle( Qt::SolidLine );
  setBrushStyle( Qt::SolidPattern );
}
示例#19
0
/*!
  Constructs a curve which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value
  axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and not have
  the same orientation. If either of these restrictions is violated, a corresponding message is
  printed to the debug output (qDebug), the construction is not aborted, though.
  
  The constructed QCPCurve can be added to the plot with QCustomPlot::addPlottable, QCustomPlot
  then takes ownership of the graph.
*/
QCPCurve::QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis) :
  QCPAbstractPlottable(keyAxis, valueAxis)
{
  mData = new QCPCurveDataMap;
  mPen.setColor(Qt::blue);
  mPen.setStyle(Qt::SolidLine);
  mBrush.setColor(Qt::blue);
  mBrush.setStyle(Qt::NoBrush);
  mSelectedPen = mPen;
  mSelectedPen.setWidthF(2.5);
  mSelectedPen.setColor(QColor(80, 80, 255)); // lighter than Qt::blue of mPen
  mSelectedBrush = mBrush;
  
  setScatterStyle(QCPScatterStyle());
  setLineStyle(lsLine);
}
示例#20
0
/*!
  \class QgsRubberBand
  \brief The QgsRubberBand class provides a transparent overlay widget
  for tracking the mouse while drawing polylines or polygons.
*/
QgsRubberBand::QgsRubberBand( QgsMapCanvas* mapCanvas, QgsWkbTypes::GeometryType geometryType )
    : QgsMapCanvasItem( mapCanvas )
    , mIconSize( 5 )
    , mIconType( ICON_CIRCLE )
    , mGeometryType( geometryType )
    , mTranslationOffsetX( 0.0 )
    , mTranslationOffsetY( 0.0 )
{
  reset( geometryType );
  QColor color( Qt::lightGray );
  color.setAlpha( 63 );
  setColor( color );
  setWidth( 1 );
  setLineStyle( Qt::SolidLine );
  setBrushStyle( Qt::SolidPattern );
}
示例#21
0
void Pedal::resetProperty(P_ID id)
      {
      switch (id) {
            case P_ID::LINE_WIDTH:
                  setLineWidth(score()->styleS(StyleIdx::pedalLineWidth));
                  lineWidthStyle = PropertyStyle::STYLED;
                  break;

            case P_ID::LINE_STYLE:
                  setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::pedalLineStyle)));
                  lineStyleStyle = PropertyStyle::STYLED;
                  break;

            default:
                  return TextLine::resetProperty(id);
            }
      }
示例#22
0
void Pedal::read(XmlReader& e)
      {
      if (score()->mscVersion() >= 110) {
            // setBeginSymbol(SymId::noSym);
            setEndHook(false);
            }
      int id = e.intAttribute("id", -1);
      e.addSpanner(id, this);
      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "subtype")          // obsolete
                  e.skipCurrentElement();
            else if (tag == "lineWidth") {
                  setLineWidth(Spatium(e.readDouble()));
                  lineWidthStyle = PropertyStyle::UNSTYLED;
                  }
            else if (tag == "lineStyle") {
                  setLineStyle(Qt::PenStyle(e.readInt()));
                  lineStyleStyle = PropertyStyle::UNSTYLED;
                  }
            else if (!TextLine::readProperties(e))
                  e.unknown();
            }
      }
示例#23
0
/*****************************************************
**
**   GraphicalEphemWidgetItem   ---   paintPlanets
**
******************************************************/
void GraphicalEphemWidgetItem::paintPlanets( Painter *painter )
{
	ObjectId p;
	double x1, x2, y1, y2;  // daily positions in y and y dimension
	double xp;              // x position for jumps
	double l1, l2;       // length of planets
	double yp, yp2, ydiff;      // length values for jumps
	const int sshift = 60;
	int lsymbolshift[sshift];
	int rsymbolshift[sshift];
	int ylshift, yrshift;
	const int xshiftunit = 15;

	const int mlen = expert->getNumberOfDays();  // length of month
	const double xstep = rect.width / mlen;  // daily step in x dimension

	wxString s;
	Lang lang;

	for ( int i = 0; i < sshift; i++ )
	{
		lsymbolshift[i] = 0;
		rsymbolshift[i] = 0;
	}

	for ( unsigned i1 = 0; i1 < expert->getPlanetdataSize(); i1++ )
	{
		p = expert->getPlanetId( i1 );

		// loop if daily motion of moon is smaller than max_deg
		if ( max_deg < 14 &&  p == OMOON ) continue;

		setLineStyle( painter, p );
		for ( int day = 0; day < mlen; day++ )
		{
			x1 =  rect.x + day * xstep;
			x2 =  x1 + xstep;
			l1 = a_red( expert->getPlanetLongitude( i1, day ), max_deg );
			y1 = ybottom - l1 * rect.height / max_deg;
			l2 = a_red( expert->getPlanetLongitude( i1, day+1 ), max_deg );
			y2 = ybottom - l2 * rect.height / max_deg;

			if ( expert->getPlanetRetro( i1, day ))
			{
				if (( l1 < l2 ) && expert->getPlanetRetro( i1, day+1 )) // handle jumps
				{
					yp = l1;
					yp2 = max_deg - l2;
					ydiff = yp / ( yp + yp2 );
					xp = (int)( x1 + ydiff * xstep );
					painter->drawLine( x1, y1, xp, ybottom );
					painter->drawLine( xp, rect.y, x2, y2 );
				}
				else // that's normal
				{
					painter->drawLine( x1, y1, x2, y2 );
				}
			}
			else // non retrograde
			{
				if (( l1 > l2 ) && ! expert->getPlanetRetro( i1, day+1 )) // handle jumps
				{
					yp = max_deg - l1;
					yp2 = l2;
					ydiff = yp / ( yp + yp2 );
					xp = x1 + ydiff * xstep;
					//printf( "2 planet %d yp %f yp2 %f x1 %d x2 %d xp %d l1 %f l2 %f ydiff %f\n", p, yp, yp2, x1, x2, xp, l1, l2, ydiff );
					painter->drawLine( x1, y1, xp, rect.y );
					painter->drawLine( xp, ybottom, x2, y2 );
				}
				else // that happens normally
				{
					painter->drawLine( x1, y1, x2, y2 );
				}
			}
		}
		if ( config->writer->planetSymbols )
		{
			painter->setSymbolFont();
			s = SymbolProvider().getPlanetCode( p );
		}
		else
		{
			painter->setGraphicFont();
			s = lang.getObjectName( p, TF_MEDIUM, props->isVedic() );
		}
		// Planet name on left side
		y1 = ybottom - a_red( expert->getPlanetLongitude( i1, 0 ), max_deg ) * rect.height / max_deg;

		assert( rect.height != 0 );
		ylshift = a_red( sshift * y1 / rect.height, 60 );

		painter->drawTextFormatted(
			wxRect( Max( rect.x - xshiftunit * lsymbolshift[ylshift] - 10, 0 ), y1 - 5, 10, 10 ), s, Align::Right+Align::VCenter );
		lsymbolshift[ylshift]++;

		// Planet name on right side
		y1 = ybottom - a_red( expert->getPlanetLongitude( i1, mlen ), max_deg ) * rect.height / max_deg;
		yrshift = a_red( sshift * y1 / rect.height, 60 );
		painter->drawTextFormatted( wxRect( xright + xshiftunit * rsymbolshift[yrshift], y1 - 5, 20, 10 ), s, Align::Left+Align::VCenter );
		rsymbolshift[yrshift]++;
	}
}
示例#24
0
bool QgsSymbol::readXML( QDomNode &synode, const QgsVectorLayer *vl )
{
  // Legacy project file formats didn't have support for pointsymbol nor
  // pointsize Dom elements.  Therefore we should check whether these
  // actually exist.

  QDomNode lvalnode = synode.namedItem( "lowervalue" );
  if ( ! lvalnode.isNull() )
  {
    QDomElement lvalelement = lvalnode.toElement();
    if ( lvalelement.attribute( "null" ).toInt() == 1 )
    {
      mLowerValue = QString::null;
    }
    else
    {
      mLowerValue = lvalelement.text();
    }
  }

  QDomNode uvalnode = synode.namedItem( "uppervalue" );
  if ( ! uvalnode.isNull() )
  {
    QDomElement uvalelement = uvalnode.toElement();
    mUpperValue = uvalelement.text();
  }

  QDomNode labelnode = synode.namedItem( "label" );
  if ( ! labelnode.isNull() )
  {
    QDomElement labelelement = labelnode.toElement();
    mLabel = labelelement.text();
  }

  QDomNode psymbnode = synode.namedItem( "pointsymbol" );

  if ( ! psymbnode.isNull() )
  {
    QDomElement psymbelement = psymbnode.toElement();
    setNamedPointSymbol( psymbelement.text() );
  }

  QDomNode psizenode = synode.namedItem( "pointsize" );

  if ( ! psizenode.isNull() )
  {
    QDomElement psizeelement = psizenode.toElement();
    setPointSize( psizeelement.text().toFloat() );
  }

  QDomNode psizeunitnodes = synode.namedItem( "pointsizeunits" );
  if ( ! psizeunitnodes.isNull() )
  {
    QDomElement psizeunitelement = psizeunitnodes.toElement();
    QgsDebugMsg( QString( "psizeunitelement:%1" ).arg( psizeunitelement.text() ) );
    setPointSizeUnits( psizeunitelement.text().compare( "mapunits", Qt::CaseInsensitive ) == 0 );
  }

  if ( vl )
  {
    mRotationClassificationField = readFieldName( synode, "rotationclassificationfield", *vl );
    mScaleClassificationField = readFieldName( synode, "scaleclassificationfield", *vl );
    mSymbolField = readFieldName( synode, "symbolfield", *vl );
  }
  else
  {
    mRotationClassificationField = -1;
    mScaleClassificationField = -1;
  }

  QDomNode outlcnode = synode.namedItem( "outlinecolor" );
  QDomElement oulcelement = outlcnode.toElement();
  int red = oulcelement.attribute( "red" ).toInt();
  int green = oulcelement.attribute( "green" ).toInt();
  int blue = oulcelement.attribute( "blue" ).toInt();
  setColor( QColor( red, green, blue ) );

  QDomNode outlstnode = synode.namedItem( "outlinestyle" );
  QDomElement outlstelement = outlstnode.toElement();
  setLineStyle( QgsSymbologyUtils::qString2PenStyle( outlstelement.text() ) );

  QDomNode outlwnode = synode.namedItem( "outlinewidth" );
  QDomElement outlwelement = outlwnode.toElement();
  setLineWidth( outlwelement.text().toDouble() );

  QDomNode fillcnode = synode.namedItem( "fillcolor" );
  QDomElement fillcelement = fillcnode.toElement();
  red = fillcelement.attribute( "red" ).toInt();
  green = fillcelement.attribute( "green" ).toInt();
  blue = fillcelement.attribute( "blue" ).toInt();
  setFillColor( QColor( red, green, blue ) );

  QDomNode texturepathnode = synode.namedItem( "texturepath" );
  QDomElement texturepathelement = texturepathnode.toElement();
  setCustomTexture( QgsProject::instance()->readPath( texturepathelement.text() ) );

  //run this after setting the custom texture path, so we override the brush if it isn't the custom pattern brush.
  QDomNode fillpnode = synode.namedItem( "fillpattern" );
  QDomElement fillpelement = fillpnode.toElement();
  setFillStyle( QgsSymbologyUtils::qString2BrushStyle( fillpelement.text() ) );

  return true;
}
示例#25
0
void qmlPlotPaintedItem::appendGraph(QQmlListProperty<qmlGraph> *list, qmlGraph *pdt)
{
	auto& info = Info(list);
	auto& m_CustomPlot = *info.plot;
	info.m_graphs.append(pdt);

	auto makeAxis = [&](QCPAxis* ref, QCPAxis::AxisType type, qmlAxis* qmlAx){
		if (qmlAx)
		{
			if (!qmlAx->isDefault())
				ref = m_CustomPlot.axisRect(0)->addAxis(type);

			ref->setVisible(qmlAx->isVisible());

			if (auto label = qmlAx->getLabel())
			{
				if (!label->getText().isEmpty())
					ref->setLabel(label->getText());
				if (label->getColor().isValid())
					ref->setLabelColor(label->getColor());
				if (!label->getFont().isEmpty())
				{
					QFont axFont; axFont.fromString(label->getFont());
					ref->setLabelFont(axFont);
				}
			}
			
			if (auto tick = qmlAx->getTick())
			{
				if (!tick->getFont().isEmpty())
					ref->setTickLabelFont(tick->getFont());
				const auto& tickVec = tick->getTickVector();
				if (!tickVec.empty())
				{
					ref->setAutoTicks(false);
					ref->setTickVector(tickVec);
				}
				const auto& tickLab = tick->getTickLabels();
				if (!tickLab.empty())
				{
					ref->setAutoTickLabels(false);
					ref->setTickVectorLabels(tickLab);
				}
			}
		}
		return ref;
	};

	auto graph = m_CustomPlot.addGraph(
		makeAxis(m_CustomPlot.xAxis, QCPAxis::atBottom, pdt->getXAxis()),
		makeAxis(m_CustomPlot.yAxis, QCPAxis::atLeft, pdt->getYAxis()));

	graph->setName(pdt->getName());
	graph->setPen(pdt->getPen()->getPen());
	graph->setLineStyle(pdt->getLineStyle());

	if (auto scatterInfo = pdt->getScatter())
	{
		graph->setScatterStyle(scatterInfo->getStyle());
	}
}
示例#26
0
LineDialog::LineDialog( ArrowMarker *line, QWidget* parent,  Qt::WFlags fl )
    : QDialog( parent, fl )
{
  unitBox=NULL;

  setWindowTitle( tr( "MantidPlot - Line options" ) );
	setAttribute(Qt::WA_DeleteOnClose);
	
	lm = line;

	QGroupBox *gb1 = new QGroupBox();
    QGridLayout *gl1 = new QGridLayout();

    gl1->addWidget(new QLabel(tr("Color")), 0, 0);
	colorBox = new ColorButton();
	colorBox->setColor(lm->color());
	gl1->addWidget(colorBox, 0, 1);

	gl1->addWidget(new QLabel(tr("Line type")), 1, 0);
    styleBox = new QComboBox();
	styleBox->insertItem("_____");
	styleBox->insertItem("- - -");
	styleBox->insertItem(".....");
	styleBox->insertItem("_._._");
	styleBox->insertItem("_.._..");
	gl1->addWidget(styleBox, 1, 1);

	setLineStyle(lm->style());

	gl1->addWidget(new QLabel(tr("Line width")), 2, 0);
    widthBox = new DoubleSpinBox('f');
  widthBox->setLocale(dynamic_cast<ApplicationWindow *>(this->parent())->locale());
	widthBox->setSingleStep(0.1);
    widthBox->setRange(0, 100);
	widthBox->setValue(lm->width());
	gl1->addWidget(widthBox, 2, 1);

	startBox = new QCheckBox();
    startBox->setText( tr( "Arrow at &start" ) );
	startBox->setChecked(lm->hasStartArrow());
	gl1->addWidget(startBox, 3, 0);

	endBox = new QCheckBox();
    endBox->setText( tr( "Arrow at &end" ) );
	endBox->setChecked(lm->hasEndArrow());
	gl1->addWidget(endBox, 3, 1);
	gl1->setRowStretch(4, 1);

	gb1->setLayout(gl1);

	QHBoxLayout* hl1 = new QHBoxLayout();
    hl1->addWidget(gb1);

	options = new QWidget();
    options->setLayout(hl1);

	tw = new QTabWidget();
	tw->addTab(options, tr( "Opti&ons" ) );

    QGroupBox *gb2 = new QGroupBox();
    QGridLayout *gl2 = new QGridLayout();

    gl2->addWidget(new QLabel(tr("Length")), 0, 0);
	boxHeadLength = new QSpinBox();
	boxHeadLength->setValue(lm->headLength());
	gl2->addWidget(boxHeadLength, 0, 1);

	gl2->addWidget(new QLabel(tr( "Angle" )), 1, 0 );
	boxHeadAngle = new QSpinBox();
	boxHeadAngle->setRange(0, 85);
	boxHeadAngle->setSingleStep(5);
	boxHeadAngle->setValue(lm->headAngle());
	gl2->addWidget(boxHeadAngle, 1, 1);

	filledBox = new QCheckBox();
    filledBox->setText( tr( "&Filled" ) );
	filledBox->setChecked(lm->filledArrowHead());
	gl2->addWidget(filledBox, 2, 1);
	gl2->setRowStretch(3, 1);

	gb2->setLayout(gl2);

	QHBoxLayout* hl2 = new QHBoxLayout();
    hl2->addWidget(gb2);

    head = new QWidget();
    head->setLayout(hl2);
	tw->addTab(head, tr("Arrow &Head"));

	initGeometryTab();

	buttonDefault = new QPushButton( tr( "Set &Default" ) );
	btnApply = new QPushButton( tr( "&Apply" ) );
	btnOk = new QPushButton(tr( "&Ok" ) );
    btnOk->setDefault(true);

    QBoxLayout *bl1 = new QBoxLayout (QBoxLayout::LeftToRight);
    bl1->addStretch();
	bl1->addWidget(buttonDefault);
	bl1->addWidget(btnApply);
	bl1->addWidget(btnOk);

	QVBoxLayout* vl = new QVBoxLayout();
    vl->addWidget(tw);
	vl->addLayout(bl1);
	setLayout(vl);

	enableHeadTab();

	connect( btnOk, SIGNAL( clicked() ), this, SLOT(accept() ) );
	connect( btnApply, SIGNAL( clicked() ), this, SLOT(apply() ) );
	connect( tw, SIGNAL(currentChanged (QWidget *)), this, SLOT(enableButtonDefault(QWidget *)));
	connect( buttonDefault, SIGNAL(clicked()), this, SLOT(setDefaultValues()));
}
示例#27
0
void scigraphics::painter::drawLineF( fpoint A, fpoint B, const lineStyle &Style )
{
  setLineStyle( Style );
  drawLineF( A, B );
}
示例#28
0
void scigraphics::painter::drawLineW( wpoint A, wpoint B, const lineStyle &Style ) 
{ 
  //std::cout << "painter::drawCoordLine()" << A.x() << " " << A.y() << " " << Style.getColor().name() << std::endl;
  setLineStyle( Style );
  drawLineW( A, B );
}