Utility class for reading and writing visual style properties of QwtPlotItem.
More...
#include <qwt_plot_styling.h>
|
| static QColor | color (const QwtPlotItem *item, const QColor &defaultColor=QColor()) |
| | Get the representative color of a plot item.
|
| |
| static bool | setColor (QwtPlotItem *item, const QColor &color) |
| | Set the color of a plot item.
|
| |
| static QPen | pen (const QwtPlotItem *item) |
| | Get the pen of a plot item.
|
| |
| static bool | setPen (QwtPlotItem *item, const QPen &pen) |
| | Set the pen of a plot item.
|
| |
| static QBrush | brush (const QwtPlotItem *item) |
| | Get the brush of a plot item.
|
| |
| static bool | setBrush (QwtPlotItem *item, const QBrush &brush) |
| | Set the brush of a plot item.
|
| |
| static void | setSymbol (QwtPlotCurve *curve, QwtSymbol::Style style, const QSize &size=QSize(8, 8)) |
| | Set a symbol on a curve with style and size.
|
| |
| static void | setSymbol (QwtPlotCurve *curve, QwtSymbol::Style style, const QColor &color, const QSize &size=QSize(8, 8)) |
| | Set a symbol on a curve with style, color and size.
|
| |
| static void | setLineStyle (QwtPlotCurve *curve, Qt::PenStyle style, qreal width=0.0) |
| | Set curve line pen style and width.
|
| |
| static qreal | recommendPenWidth (int pointCount) |
| | Recommend a pen width based on the number of data points.
|
| |
| static void | forceReplot (QwtPlot *plot) |
| | Force an immediate replot even when autoReplot is disabled.
|
| |
Utility class for reading and writing visual style properties of QwtPlotItem.
QwtPlotStyling provides type-safe static methods to get or set the color, pen, brush, and symbol of any QwtPlotItem, dispatching through the item's rtti to call the correct type-specific API.
Also provides convenience methods for common styling operations such as setting a curve's symbol or recommending pen widths based on data density.
QColor c = Qwt::QwtPlotStyling::color(item);
Qwt::QwtPlotStyling::setColor(item, Qt::red);
Base class for items on the plot canvas.
Definition qwt_plot_item.h:85
@ Ellipse
Ellipse or circle.
Definition qwt_symbol.h:63
- See also
- QwtPlotItemInfo, QwtPlotDataAccess
◆ brush()
| QBrush QwtPlotStyling::brush |
( |
const QwtPlotItem * |
item | ) |
|
|
static |
Get the brush of a plot item.
- Parameters
-
- Returns
- The primary brush of the item, or a default QBrush if not recognized
◆ color()
| QColor QwtPlotStyling::color |
( |
const QwtPlotItem * |
item, |
|
|
const QColor & |
defaultColor = QColor() |
|
) |
| |
|
static |
Get the representative color of a plot item.
- Parameters
-
| item | Plot item to query |
| defaultColor | Color to return if the item type is not recognized |
- Returns
- The primary color of the item (from pen or brush)
Uses the item's rtti to dispatch to the correct type-specific API. For curves, returns the pen color; for bar charts, the brush color; for grids, the major pen color; etc.
◆ forceReplot()
| void QwtPlotStyling::forceReplot |
( |
QwtPlot * |
plot | ) |
|
|
static |
Force an immediate replot even when autoReplot is disabled.
- Parameters
-
Temporarily enables ImmediatePaint on the canvas (if it is a QwtPlotCanvas), performs a replot, and restores the previous paint attributes.
◆ pen()
Get the pen of a plot item.
- Parameters
-
- Returns
- The primary pen of the item, or a default QPen if not recognized
◆ recommendPenWidth()
| qreal QwtPlotStyling::recommendPenWidth |
( |
int |
pointCount | ) |
|
|
static |
Recommend a pen width based on the number of data points.
- Parameters
-
| pointCount | Number of data points in the series |
- Returns
- Recommended pen width
For large datasets (>10000 points), a thinner pen improves rendering performance and visual clarity. For small datasets, a wider pen provides better visibility.
◆ setBrush()
| bool QwtPlotStyling::setBrush |
( |
QwtPlotItem * |
item, |
|
|
const QBrush & |
brush |
|
) |
| |
|
static |
Set the brush of a plot item.
- Parameters
-
| item | Plot item to modify |
| brush | New brush to apply |
- Returns
- true if the brush was successfully applied
◆ setColor()
| bool QwtPlotStyling::setColor |
( |
QwtPlotItem * |
item, |
|
|
const QColor & |
color |
|
) |
| |
|
static |
Set the color of a plot item.
- Parameters
-
| item | Plot item to modify |
| color | New color to apply |
- Returns
- true if the color was successfully applied
For curves, sets the pen color; for bar charts and histograms, sets both pen color and brush color; for grids, sets the major pen color.
◆ setLineStyle()
| void QwtPlotStyling::setLineStyle |
( |
QwtPlotCurve * |
curve, |
|
|
Qt::PenStyle |
style, |
|
|
qreal |
width = 0.0 |
|
) |
| |
|
static |
Set curve line pen style and width.
- Parameters
-
| curve | Target curve |
| style | Pen style (solid, dashed, dotted, etc.) |
| width | Pen width (0 = cosmetic) |
◆ setPen()
| bool QwtPlotStyling::setPen |
( |
QwtPlotItem * |
item, |
|
|
const QPen & |
pen |
|
) |
| |
|
static |
Set the pen of a plot item.
- Parameters
-
| item | Plot item to modify |
| pen | New pen to apply |
- Returns
- true if the pen was successfully applied
◆ setSymbol() [1/2]
Set a symbol on a curve with style, color and size.
- Parameters
-
| curve | Target curve |
| style | Symbol style |
| color | Symbol fill color |
| size | Symbol size in pixels |
◆ setSymbol() [2/2]
Set a symbol on a curve with style and size.
- Parameters
-
| curve | Target curve |
| style | Symbol style (ellipse, rect, diamond, etc.) |
| size | Symbol size in pixels |
The documentation for this class was generated from the following files:
- /home/runner/work/QWT/QWT/src/plot/qwt_plot_styling.h
- /home/runner/work/QWT/QWT/src/plot/qwt_plot_styling.cpp