logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

QwtSymbol - A class for drawing symbols.

Author

       Generated automatically by Doxygen for Qwt User's Guide from the source code.

Version 6.1.4                                    Wed Jan 2 2019                                     QwtSymbol(3)

Constructor & Destructor Documentation

QwtSymbol::QwtSymbol(Stylestyle=NoSymbol)
       Default Constructor

       Parameters:style Symbol Style

       The  symbol  is  constructed  with  gray  interior,  black  outline  with  zero  width, no size and style
       'NoSymbol'.

   QwtSymbol::QwtSymbol(QwtSymbol::Stylestyle,constQBrush&brush,constQPen&pen,constQSize&size)
       Constructor.

       Parameters:style Symbol Style
           brush brush to fill the interior
           pen outline pen
           size size

       Seealso:setStyle(), setBrush(), setPen(), setSize()QwtSymbol::QwtSymbol(constQPainterPath&path,constQBrush&brush,constQPen&pen)
       Constructor. The symbol gets initialized by a painter path. The style is set to QwtSymbol::Path, the size
       is set to empty ( the path is displayed unscaled ).

       Parameters:path painter path
           brush brush to fill the interior
           pen outline pen

       Seealso:setPath(), setBrush(), setPen(), setSize()

Detailed Description

       A class for drawing symbols.

Member Enumeration Documentation

enumQwtSymbol::CachePolicy
       Depending on the render engine and the complexity of the symbol shape it might be faster to render the
       symbol to a pixmap and to paint this pixmap.

       F.e. the raster paint engine is a pure software renderer where in cache mode a draw operation usually
       ends in raster operation with the the backing store, that are usually faster, than the algorithms for
       rendering polygons. But the opposite can be expected for graphic pipelines that can make use of hardware
       acceleration.

       The default setting is AutoCache

       Seealso:setCachePolicy(), cachePolicy()Note:
           The policy has no effect, when the symbol is painted to a vector graphics format ( PDF, SVG ).

       Warning:
           Since Qt 4.8 raster is the default backend on X11

       EnumeratorNoCache
              Don't use a pixmap cache.

       Cache  Always use a pixmap cache.

       AutoCache
              Use a cache when one of the following conditions is true:

       • The symbol is rendered with the software renderer ( QPaintEngine::Raster )

   enumQwtSymbol::Style
       Symbol Style

       Seealso:setStyle(), style()EnumeratorNoSymbol
              No Style. The symbol cannot be drawn.

       Ellipse
              Ellipse or circle.

       Rect   Rectangle.

       Diamond
              Diamond.

       Triangle
              Triangle pointing upwards.

       DTriangle
              Triangle pointing downwards.

       UTriangle
              Triangle pointing upwards.

       LTriangle
              Triangle pointing left.

       RTriangle
              Triangle pointing right.

       Cross  Cross (+)

       XCross Diagonal cross (X)

       HLine  Horizontal line.

       VLine  Vertical line.

       Star1  X combined with +.

       Star2  Six-pointed star.

       Hexagon
              Hexagon.

       Path   The  symbol  is  represented  by  a painter path, where the origin ( 0, 0 ) of the path coordinate
              system is mapped to the position of the symbol.

       Seealso:setPath(), path()Pixmap The symbol is represented by a pixmap. The pixmap is centered or aligned to its pin point.

       Seealso:setPinPoint()Graphic
              The symbol is represented by a graphic. The graphic is centered or aligned to its pin point.

       Seealso:setPinPoint()SvgDocument
              The symbol is represented by a SVG graphic. The graphic is centered or aligned to its pin point.

       Seealso:setPinPoint()UserStyle
              Styles >= QwtSymbol::UserSymbol are reserved  for  derived  classes  of  QwtSymbol  that  overload
              drawSymbols() with additional application specific symbol types.

Member Function Documentation

QRectQwtSymbol::boundingRect()const[virtual]
       Calculate the bounding rectangle for a symbol at position (0,0).

       Returns:
           Bounding rectangle

   constQBrush&QwtSymbol::brush()constReturns:
           Brush

       Seealso:setBrush()QwtSymbol::CachePolicyQwtSymbol::cachePolicy()constReturns:
           Cache policy

       Seealso:CachePolicy, setCachePolicy()voidQwtSymbol::drawSymbol(QPainter*painter,constQRectF&rect)const
       Draw the symbol into a rectangle. The symbol is painted centered and scaled into the target rectangle. It
       is always painted uncached and the pin point is ignored.

       This method is primarily intended for drawing a symbol to the legend.

       Parameters:painter Painter
           rect Target rectangle for the symbol

   voidQwtSymbol::drawSymbol(QPainter*painter,constQPointF&pos)const[inline]
       Draw the symbol at a specified position.

       Parameters:painter Painter
           pos Position of the symbol in screen coordinates

   voidQwtSymbol::drawSymbols(QPainter*painter,constQPolygonF&points)const[inline]
       Draw symbols at the specified points.

       Parameters:painter Painter
           points Positions of the symbols in screen coordinates

   voidQwtSymbol::drawSymbols(QPainter*painter,constQPointF*points,intnumPoints)const
       Render an array of symbols

       Painting several symbols is more effective than drawing symbols  one  by  one,  as  a  couple  of  layout
       calculations and setting of pen/brush can be done once for the complete array.

       Parameters:painter Painter
           points Array of points
           numPoints Number of points

   constQwtGraphic&QwtSymbol::graphic()constReturns:
           Assigned graphic

       Seealso:setGraphic()voidQwtSymbol::invalidateCache()
       Invalidate the cached symbol pixmap

       The symbol invalidates its cache, whenever an attribute is changed that has an effect ob how to display a
       symbol.  In  case  of  derived  classes  with  individual  styles ( >= QwtSymbol::UserStyle ) it might be
       necessary to call invalidateCache() for attributes that are relevant for this style.

       Seealso:CachePolicy, setCachePolicy(), drawSymbols()boolQwtSymbol::isPinPointEnabled()constReturns:
           True, when the pin point translation is enabled

       Seealso:setPinPoint(), setPinPointEnabled()constQPainterPath&QwtSymbol::path()constReturns:
           Painter path for displaying the symbol

       Seealso:setPath()constQPen&QwtSymbol::pen()constReturns:
           Pen

       Seealso:setPen(), brush()QPointFQwtSymbol::pinPoint()constReturns:
           Pin point

       Seealso:setPinPoint(), setPinPointEnabled()constQPixmap&QwtSymbol::pixmap()constReturns:
           Assigned pixmap

       Seealso:setPixmap()voidQwtSymbol::renderSymbols(QPainter*painter,constQPointF*points,intnumPoints)const[protected],[virtual]
       Render the symbol to series of points

       Parameters:painter Qt painter
           points Positions of the symbols
           numPoints Number of points

   voidQwtSymbol::setBrush(constQBrush&brush)
       Assign a brush. The brush is used to draw the interior of the symbol.

       Parameters:brush Brush

       Seealso:brush()voidQwtSymbol::setCachePolicy(QwtSymbol::CachePolicypolicy)
       Change the cache policy

       The default policy is AutoCache

       Parameters:policy Cache policy

       Seealso:CachePolicy, cachePolicy()voidQwtSymbol::setColor(constQColor&color)[virtual]
       Set  the  color of the symbol. Change the color of the brush for symbol types with a filled area. For all
       other symbol types the color will be assigned to the pen.

       Parameters:color Color

       Seealso:setBrush(), setPen(), brush(), pen()voidQwtSymbol::setGraphic(constQwtGraphic&graphic)
       Set a graphic as symbol

       Parameters:graphic Graphic

       Seealso:graphic(), setPixmap()Note:
           the style() is set to QwtSymbol::Graphicbrush() and pen() have no effect

   voidQwtSymbol::setPath(constQPainterPath&path)
       Set a painter path as symbol. The symbol is represented by a painter path, where the origin ( 0, 0  )  of
       the path coordinate system is mapped to the position of the symbol.

       When  the  symbol  has valid size the painter path gets scaled to fit into the size. Otherwise the symbol
       size depends on the bounding rectangle of the path.

       Example
           The following code defines a symbol drawing an arrow:

       #include <qwt_symbol.h>

       QwtSymbol *symbol = new QwtSymbol();

       QPen pen( Qt::black, 2 );
       pen.setJoinStyle( Qt::MiterJoin );

       symbol->setPen( pen );
       symbol->setBrush( Qt::red );

       QPainterPath path;
       path.moveTo( 0, 8 );
       path.lineTo( 0, 5 );
       path.lineTo( -3, 5 );
       path.lineTo( 0, 0 );
       path.lineTo( 3, 5 );
       path.lineTo( 0, 5 );

       QTransform transform;
       transform.rotate( -30.0 );
       path = transform.map( path );

       symbol->setPath( path );
       symbol->setPinPoint( QPointF( 0.0, 0.0 ) );

       setSize( 10, 14 );

       Parameters:path Painter path

       Note:
           The style is implicitely set to QwtSymbol::Path.

       Seealso:path(), setSize()voidQwtSymbol::setPen(constQColor&color,qrealwidth=0.0,Qt::PenStylestyle=Qt::SolidLine)
       Build and assign a 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.

       Parameters:color Pen color
           width Pen width
           style Pen style

       Seealso:pen(), brush()voidQwtSymbol::setPen(constQPen&pen)
       Assign a pen

       The pen is used to draw the symbol's outline.

       Parameters:pen Pen

       Seealso:pen(), setBrush()voidQwtSymbol::setPinPoint(constQPointF&pos,boolenable=true)
       Set and enable a pin point. The position of a complex symbol is not always aligned to its center ( f.e an
       arrow, where the peak points to a position ). The pin point defines the  position  inside  of  a  Pixmap,
       Graphic, SvgDocument or PainterPath symbol where the represented point has to be aligned to.

       Parameters:pos Position
           enable En/Disable the pin point alignment

       Seealso:pinPoint(), setPinPointEnabled()voidQwtSymbol::setPinPointEnabled(boolon)
       En/Disable the pin point alignment

       Parameters:on Enabled, when on is true

       Seealso:setPinPoint(), isPinPointEnabled()voidQwtSymbol::setPixmap(constQPixmap&pixmap)
       Set a pixmap as symbol

       Parameters:pixmap Pixmap

       Seealso:pixmap(), setGraphic()Note:
           the style() is set to QwtSymbol::Pixmapbrush() and pen() have no effect

   voidQwtSymbol::setSize(constQSize&size)
       Set the symbol's size

       Parameters:size Size

       Seealso:size()voidQwtSymbol::setSize(intwidth,intheight=-1)
       Specify  the  symbol's  size.  If  the 'h' parameter is left out or less than 0, and the 'w' parameter is
       greater than or equal to 0, the symbol size will be set to (w,w).

       Parameters:width Width
           height Height (defaults to -1)

       Seealso:size()voidQwtSymbol::setStyle(QwtSymbol::Stylestyle)
       Specify the symbol style

       Parameters:style Style

       Seealso:style()voidQwtSymbol::setSvgDocument(constQByteArray&svgDocument)
       Set a SVG icon as symbol

       Parameters:svgDocument SVG icon

       Seealso:setGraphic(), setPixmap()Note:
           the style() is set to QwtSymbol::SvgDocumentbrush() and pen() have no effect

   constQSize&QwtSymbol::size()constReturns:
           Size

       Seealso:setSize()QwtSymbol::StyleQwtSymbol::style()constReturns:
           Current symbol style

       Seealso:setStyle()

Name

       QwtSymbol - A class for drawing symbols.

Synopsis

       #include <qwt_symbol.h>

   PublicTypes
       enum Style { NoSymbol = -1, Ellipse, Rect, Diamond, Triangle, DTriangle, UTriangle, LTriangle, RTriangle,
           Cross, XCross, HLine, VLine, Star1, Star2, Hexagon, Path, Pixmap, Graphic, SvgDocument, UserStyle =
           1000 }
       enum CachePolicy { NoCache, Cache, AutoCache }

   PublicMemberFunctionsQwtSymbol (Style=NoSymbol)
       QwtSymbol (Style, const QBrush &, const QPen &, const QSize &)
           Constructor.
       QwtSymbol (const QPainterPath &, const QBrush &, const QPen &)
           Constructor.
       virtual ~QwtSymbol ()
           Destructor.
       void setCachePolicy (CachePolicy)
       CachePolicycachePolicy () const
       void setSize (const QSize &)
       void setSize (int width, int height=-1)
           Specify the symbol's size.
       const QSize & size () const
       void setPinPoint (const QPointF &pos, bool enable=true)
           Set and enable a pin point.
       QPointF pinPoint () const
       void setPinPointEnabled (bool)
       bool isPinPointEnabled () const
       virtual void setColor (const QColor &)
           Set the color of the symbol.
       void setBrush (const QBrush &)
           Assign a brush.
       const QBrush & brush () const
       void setPen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
       void setPen (const QPen &)
       const QPen & pen () const
       void setStyle (Style)
       Stylestyle () const
       void setPath (const QPainterPath &)
           Set a painter path as symbol.
       const QPainterPath & path () const
       void setPixmap (const QPixmap &)
       const QPixmap & pixmap () const
       void setGraphic (const QwtGraphic &)
       const QwtGraphic & graphic () const
       void setSvgDocument (const QByteArray &)
       void drawSymbol (QPainter *, const QRectF &) const
           Draw the symbol into a rectangle.
       void drawSymbol (QPainter *, const QPointF &) const
           Draw the symbol at a specified position.
       void drawSymbols (QPainter *, const QPolygonF &) const
           Draw symbols at the specified points.
       void drawSymbols (QPainter *, const QPointF *, int numPoints) const
       virtual QRect boundingRect () const
       void invalidateCache ()

   ProtectedMemberFunctions
       virtual void renderSymbols (QPainter *, const QPointF *, int numPoints) const

See Also