本文整理汇总了C++中QwtPlotMarker::setLinePen方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotMarker::setLinePen方法的具体用法?C++ QwtPlotMarker::setLinePen怎么用?C++ QwtPlotMarker::setLinePen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotMarker
的用法示例。
在下文中一共展示了QwtPlotMarker::setLinePen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enableZeroLineX
void Grid::enableZeroLineX(bool enable)
{
Plot *d_plot = (Plot *)plot();
if (!d_plot)
return;
if (mrkX<0 && enable) {
QwtPlotMarker *m = new QwtPlotMarker();
mrkX = d_plot->insertMarker(m);
m->setRenderHint(QwtPlotItem::RenderAntialiased, false);
m->setAxis(xAxis(), yAxis());
m->setLineStyle(QwtPlotMarker::VLine);
m->setValue(0.0, 0.0);
double width = 1;
if (d_plot->canvas()->lineWidth())
width = d_plot->canvas()->lineWidth();
else if (d_plot->axisEnabled (QwtPlot::yLeft) || d_plot->axisEnabled (QwtPlot::yRight))
width = d_plot->axesLinewidth();
m->setLinePen(QPen(Qt::black, width, Qt::SolidLine));
} else if (mrkX >= 0 && !enable) {
d_plot->removeMarker(mrkX);
mrkX=-1;
}
}
示例2: drawLapMarkers
void PlotWindow::drawLapMarkers()
{
if (_data_log->numLaps() > 1)
{
for (int i=0; i < _data_log->numLaps(); ++i)
{
QwtPlotMarker* marker = new QwtPlotMarker;
marker->setLineStyle(QwtPlotMarker::VLine);
marker->setLinePen(QPen(Qt::DotLine));
if (_x_axis_measurement->currentIndex() == 0) // time
{
const double time = _data_log->time(_data_log->lap(i).second);
marker->setXValue(time);
}
else // distance
{
const double dist = _data_log->dist(_data_log->lap(i).second);
marker->setXValue(dist);
}
marker->attach(_plot);
marker->show();
_lap_markers.push_back(marker);
}
}
}
示例3: enableZeroLineY
void Grid::enableZeroLineY(bool enable) {
Plot *d_plot = dynamic_cast<Plot *>(plot());
if (!d_plot)
return;
if (mrkY < 0 && enable) {
QwtPlotMarker *m = new QwtPlotMarker();
mrkY = d_plot->insertMarker(m);
m->setRenderHint(QwtPlotItem::RenderAntialiased, false);
m->setAxis(xAxis(), yAxis());
m->setLineStyle(QwtPlotMarker::HLine);
m->setValue(0.0, 0.0);
double width = 1;
if (d_plot->canvas()->lineWidth())
width = d_plot->canvas()->lineWidth();
else if (d_plot->axisEnabled(QwtPlot::xBottom) ||
d_plot->axisEnabled(QwtPlot::xTop))
width = d_plot->axesLinewidth();
m->setLinePen(QPen(Qt::black, width, Qt::SolidLine));
} else if (mrkY >= 0 && !enable) {
d_plot->removeMarker(mrkY);
mrkY = -1;
}
}
示例4: clear
void Plot::clear()
{
this->detachItems();
pointsArr.clear();
// ...a horizontal line at y = 1...
QwtPlotMarker *mY1 = new QwtPlotMarker();
mY1->setLabel( QString::fromLatin1( "y = 1" ) );
mY1->setLabelAlignment( Qt::AlignRight | Qt::AlignTop );
mY1->setLineStyle( QwtPlotMarker::HLine );
mY1->setYValue( 1.0 );
mY1->setLinePen(Qt::black, 1, Qt::DashLine);
mY1->attach( this );
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabel( QString::fromLatin1( "y = 0" ) );
mY->setLabelAlignment( Qt::AlignRight | Qt::AlignTop );
mY->setLineStyle( QwtPlotMarker::HLine );
mY->setYValue( 0.0 );
mY->attach( this );
// ...a vertical line at x = 0
QwtPlotMarker *mX = new QwtPlotMarker();
mX->setLabel( QString::fromLatin1( "x = 0" ) );
mX->setLabelAlignment( Qt::AlignLeft | Qt::AlignBottom );
mX->setLabelOrientation( Qt::Vertical );
mX->setLineStyle( QwtPlotMarker::VLine );
mX->setLinePen( Qt::black, 0, Qt::DashDotLine );
mX->setXValue( 0 );
mX->attach( this );
}
示例5: Plot_AddHLine
void Plot_AddHLine(QwtPlot* plot, double value , double r , double g, double b)
{
QwtPlotMarker *marker = new QwtPlotMarker();
marker->setLineStyle ( QwtPlotMarker::HLine );
marker->setLinePen(QPen(QColor(r, g, b, 128), 1, Qt::DashDotLine));
marker->attach( plot );
marker->setYValue( value );
}
示例6: createVerticalPlotMarker
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtPlotMarker* RicGridStatisticsDialog::createVerticalPlotMarker(const QColor& color, double xValue)
{
QwtPlotMarker* marker = new QwtPlotMarker();
marker->setXValue(xValue);
marker->setLineStyle(QwtPlotMarker::VLine);
marker->setLinePen(color, 2, Qt::SolidLine);
return marker;
}
示例7: markerPen
/**
* This is a helper method to create new band markers with the same line
* style and a custom color.
*
* @param color The color of the band marker
* @return The requested plot marker; ownership is passed to the caller
*/
QwtPlotMarker *SpectralPlotWindow::createMarker(QColor color) {
QPen markerPen(color);
markerPen.setWidth(1);
QwtPlotMarker *newMarker = new QwtPlotMarker;
newMarker->setLineStyle(QwtPlotMarker::LineStyle(2));
newMarker->setLinePen(markerPen);
newMarker->attach(plot());
newMarker->setVisible(false);
return newMarker;
}
示例8: setMarkerPen
/*!
\brief Specify a pen for a marker's label.
\param key Marker key
\param p New pen
\return \c TRUE if the specified marker exists
*/
bool QwtPlot::setMarkerPen(long key, const QPen &p)
{
int rv = FALSE;
QwtPlotMarker *m;
if ((m = d_markers->find(key)))
{
m->setLinePen(p);
m->setLabelPen(p);
rv = TRUE;
}
return rv;
}
示例9: setTitle
Plot::Plot()
{
setTitle("A Simple QwtPlot Demonstration");
insertLegend(new QwtLegend(), QwtPlot::RightLegend);
// Set axis titles
setAxisTitle(xBottom, "x -->");
setAxisTitle(yLeft, "y -->");
// Insert new curves
QwtPlotCurve *cSin = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cSin->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cSin->setPen(QPen(Qt::red));
cSin->attach(this);
QwtPlotCurve *cCos = new QwtPlotCurve("y = cos(x)");
#if QT_VERSION >= 0x040000
cCos->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cCos->setPen(QPen(Qt::blue));
cCos->attach(this);
// Create sin and cos data
const int nPoints = 100;
cSin->setData(SimpleData(::sin, nPoints));
cCos->setData(SimpleData(::cos, nPoints));
// Insert markers
// ...a horizontal line at y = 0...
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabel(QString::fromLatin1("y = 0"));
mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mY->setLineStyle(QwtPlotMarker::HLine);
mY->setYValue(0.0);
mY->attach(this);
// ...a vertical line at x = 2 * pi
QwtPlotMarker *mX = new QwtPlotMarker();
mX->setLabel(QString::fromLatin1("x = 2 pi"));
mX->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom);
mX->setLabelOrientation(Qt::Vertical);
mX->setLineStyle(QwtPlotMarker::VLine);
mX->setLinePen(QPen(Qt::black, 0, Qt::DashDotLine));
mX->setXValue(2.0 * M_PI);
mX->attach(this);
}
示例10: addMarker
void Graph::addMarker(double val, const QColor &color, int axis)
{
QwtPlotMarker *m = new QwtPlotMarker();
m->setLineStyle(axis == QwtPlot::xBottom ? QwtPlotMarker::VLine : QwtPlotMarker::HLine);
m->setLinePen(QPen(color));
m->setYAxis(axis);
m->setValue(val, val);
m->attach(this);
m->setLabel(QString::number(val));
if(axis == QwtPlot::xBottom)
m->setLabelAlignment(Qt::AlignLeft | Qt::AlignVCenter);
else
m->setLabelAlignment(Qt::AlignTop | Qt::AlignHCenter);
getMarkers(axis).push_back(m);
}
示例11: drawBar
void QmitkTbssRoiAnalysisWidget::drawBar(int x)
{
m_Plot->detachItems(QwtPlotItem::Rtti_PlotMarker, true);
QwtPlotMarker *mX = new QwtPlotMarker();
//mX->setLabel(QString::fromLatin1("selected point"));
mX->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom);
mX->setLabelOrientation(Qt::Vertical);
mX->setLineStyle(QwtPlotMarker::VLine);
mX->setLinePen(QPen(Qt::black, 0, Qt::SolidLine));
mX->setXValue(x);
mX->attach(m_Plot);
this->Replot();
}
示例12: populate
void Plot::populate()
{
// Insert new curves
QwtPlotCurve *cSin = new QwtPlotCurve("y = sin(x)");
cSin->setRenderHint(QwtPlotItem::RenderAntialiased);
cSin->setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
cSin->setPen(QPen(Qt::red));
cSin->attach(this);
QwtPlotCurve *cCos = new QwtPlotCurve("y = cos(x)");
cCos->setRenderHint(QwtPlotItem::RenderAntialiased);
cCos->setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
cCos->setPen(QPen(Qt::blue));
cCos->attach(this);
// Create sin and cos data
cSin->setData(new FunctionData(::sin));
cCos->setData(new FunctionData(::cos));
// Insert markers
// ...a horizontal line at y = 0...
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabel(QString::fromLatin1("y = 0"));
mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mY->setLineStyle(QwtPlotMarker::HLine);
mY->setYValue(0.0);
mY->attach(this);
// ...a vertical line at x = 2 * pi
QwtPlotMarker *mX = new QwtPlotMarker();
mX->setLabel(QString::fromLatin1("x = 2 pi"));
mX->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom);
mX->setLabelOrientation(Qt::Vertical);
mX->setLineStyle(QwtPlotMarker::VLine);
mX->setLinePen(QPen(Qt::black, 0, Qt::DashDotLine));
mX->setXValue(2.0 * M_PI);
mX->attach(this);
}
示例13: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_accelXPoints(100, QPointF(0, 0)), m_accelYPoints(100, QPointF(0, 0)),
m_gyroXPoints(100, QPointF(0, 0)), m_gyroYPoints(100, QPointF(0, 0)),
m_counter(0), m_power(0)
{
ui->setupUi(this);
// init scenes
xScene = new QGraphicsScene();
yScene = new QGraphicsScene();
xScene->setBackgroundBrush(Qt::white);
yScene->setBackgroundBrush(Qt::white);
ui->xGraphicsView->setScene(xScene);
ui->yGraphicsView->setScene(yScene);
m_tcpSocket = new QTcpSocket(this);
connect(m_tcpSocket, SIGNAL(readyRead()), this, SLOT(onTcpRead()));
m_controlSocket = new QTcpSocket(this);
connect(m_tcpSocket, SIGNAL(readyRead()), this, SLOT(onControlRead()));
// connecting
connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectToServer()));
connect(ui->disconnectButton, SIGNAL(clicked()), this, SLOT(disconnectFromServer()));
// control buttons
connect(ui->up2Button, SIGNAL(clicked()), this, SLOT(handleControlButton()));
connect(ui->up1Button, SIGNAL(clicked()), this, SLOT(handleControlButton()));
connect(ui->zeroButton, SIGNAL(clicked()), this, SLOT(handleControlButton()));
connect(ui->down1Button, SIGNAL(clicked()), this, SLOT(handleControlButton()));
connect(ui->down2Button, SIGNAL(clicked()), this, SLOT(handleControlButton()));
// plotting setup
m_accelXData = new QwtPointSeriesData();
m_accelYData = new QwtPointSeriesData();
m_accelXCurve = new QwtPlotCurve("Accel X");
m_accelYCurve = new QwtPlotCurve("Accel Y");
m_accelXCurve->setPen( QPen( Qt::black ) );
m_accelYCurve->setPen( QPen( Qt::red));
m_accelXCurve->attach( ui->plot );
m_accelYCurve->attach(ui->plot);
m_gyroXData = new QwtPointSeriesData();
m_gyroYData = new QwtPointSeriesData();
m_gyroXCurve = new QwtPlotCurve("Gyro X");
m_gyroYCurve = new QwtPlotCurve("Gyro Y");
m_gyroXCurve->setPen( QPen( Qt::green ) );
m_gyroYCurve->setPen( QPen( Qt::blue));
m_gyroXCurve->attach( ui->plot );
m_gyroYCurve->attach(ui->plot);
ui->plot->setCanvasBackground(Qt::white);
// Axes
ui->plot->setAxisTitle( QwtPlot::xBottom, "Seconds" );
ui->plot->setAxisTitle( QwtPlot::yLeft, "Degrees" );
ui->plot->setAxisScale( QwtPlot::yLeft, -90, 90 );
// zero line
QwtPlotMarker* zeroMarker = new QwtPlotMarker();
zeroMarker->setLineStyle(QwtPlotMarker::HLine);
zeroMarker->setLinePen(QPen(Qt::DotLine));
zeroMarker->setSymbol(new QwtSymbol(QwtSymbol::HLine));
zeroMarker->setYValue(0);
zeroMarker->attach(ui->plot);
updatePlot(0, 0, 0, 0);
}
示例14: reset
//.........这里部分代码省略.........
scale->minBorderDist(startDist, endDist);
scale->setBorderDist(startDist, endDist);
}
}
plot->setBackgroundColor(d_cache->widgetBackground);
plot->setCanvasBackground(d_cache->canvasBackground);
QPen pen = plot->d_grid->majPen();
pen.setColor(d_cache->gridColors[0]);
plot->d_grid->setMajPen(pen);
pen = plot->d_grid->minPen();
pen.setColor(d_cache->gridColors[1]);
plot->d_grid->setMinPen(pen);
QIntDictIterator<QwtPlotCurve> itc(*plot->d_curves);
for (QwtPlotCurve *c = itc.toFirst(); c != 0; c = ++itc )
{
const int key = itc.currentKey();
QwtSymbol symbol = c->symbol();
color = d_cache->curveSymbolPenColors.find(key);
if ( color )
{
QPen pen = symbol.pen();
pen.setColor(*color);
symbol.setPen(pen);
}
color = d_cache->curveSymbolBrushColors.find(key);
if ( color )
{
QBrush brush = symbol.brush();
brush.setColor(*color);
symbol.setBrush(brush);
}
c->setSymbol(symbol);
color = d_cache->curveColors.find(key);
if ( color )
{
QPen pen = c->pen();
pen.setColor(*color);
c->setPen(pen);
}
}
QIntDictIterator<QwtPlotMarker> itm(*plot->d_markers);
for (QwtPlotMarker *m = itm.toFirst(); m != 0; m = ++itm )
{
const int key = itm.currentKey();
font = d_cache->markerFonts.find(key);
if ( font )
m->setFont(*font);
color = d_cache->markerLabelColors.find(key);
if ( color )
{
QPen pen = m->labelPen();
pen.setColor(*color);
m->setLabelPen(pen);
}
color = d_cache->markerLineColors.find(key);
if ( color )
{
QPen pen = m->linePen();
pen.setColor(*color);
m->setLinePen(pen);
}
QwtSymbol symbol = m->symbol();
color = d_cache->markerSymbolPenColors.find(key);
if ( color )
{
QPen pen = symbol.pen();
pen.setColor(*color);
symbol.setPen(pen);
}
color = d_cache->markerSymbolBrushColors.find(key);
if ( color )
{
QBrush brush = symbol.brush();
brush.setColor(*color);
symbol.setBrush(brush);
}
m->setSymbol(symbol);
}
QwtPlotPrintFilter *that = (QwtPlotPrintFilter *)this;
delete that->d_cache;
that->d_cache = 0;
}
示例15: apply
//.........这里部分代码省略.........
if ( scale )
{
cache.scaleColor[axis] = scale->palette().color(
QPalette::Active, QColorGroup::Foreground);
QPalette palette = scale->palette();
palette.setColor(QPalette::Active, QColorGroup::Foreground,
color(cache.scaleColor[axis], AxisScale, axis));
scale->setPalette(palette);
cache.scaleFont[axis] = scale->font();
scale->setFont(font(cache.scaleFont[axis], AxisScale, axis));
cache.scaleTitleColor[axis] = scale->titleColor();
scale->setTitleColor(
color(cache.scaleTitleColor[axis], AxisTitle, axis));
cache.scaleTitleFont[axis] = scale->titleFont();
scale->setTitleFont(
font(cache.scaleTitleFont[axis], AxisTitle, axis));
int startDist, endDist;
scale->minBorderDist(startDist, endDist);
scale->setBorderDist(startDist, endDist);
}
}
cache.widgetBackground = plot->backgroundColor();
plot->setBackgroundColor(color(cache.widgetBackground, WidgetBackground));
cache.canvasBackground = plot->canvasBackground();
plot->setCanvasBackground(color(cache.canvasBackground, CanvasBackground));
QPen pen = plot->d_grid->majPen();
cache.gridColors[0] = pen.color();
pen.setColor(color(pen.color(), MajorGrid));
plot->d_grid->setMajPen(pen);
pen = plot->d_grid->minPen();
cache.gridColors[1] = pen.color();
pen.setColor(color(pen.color(), MinorGrid));
plot->d_grid->setMinPen(pen);
QIntDictIterator<QwtPlotCurve> itc(*plot->d_curves);
for (QwtPlotCurve *c = itc.toFirst(); c != 0; c = ++itc )
{
const int key = itc.currentKey();
QwtSymbol symbol = c->symbol();
QPen pen = symbol.pen();
cache.curveSymbolPenColors.insert(key, new QColor(pen.color()));
pen.setColor(color(pen.color(), CurveSymbol, key));
symbol.setPen(pen);
QBrush brush = symbol.brush();
cache.curveSymbolBrushColors.insert(key, new QColor(brush.color()));
brush.setColor(color(brush.color(), CurveSymbol, key));
symbol.setBrush(brush);
c->setSymbol(symbol);
pen = c->pen();
cache.curveColors.insert(key, new QColor(pen.color()));
pen.setColor(color(pen.color(), Curve, key));
c->setPen(pen);
}
QIntDictIterator<QwtPlotMarker> itm(*plot->d_markers);
for (QwtPlotMarker *m = itm.toFirst(); m != 0; m = ++itm )
{
const int key = itm.currentKey();
cache.markerFonts.insert(key, new QFont(m->font()));
m->setFont(font(m->font(), Marker, key));
QPen pen = m->labelPen();
cache.markerLabelColors.insert(key, new QColor(pen.color()));
pen.setColor(color(pen.color(), Marker, key));
m->setLabelPen(pen);
pen = m->linePen();
cache.markerLineColors.insert(key, new QColor(pen.color()));
pen.setColor(color(pen.color(), Marker, key));
m->setLinePen(pen);
QwtSymbol symbol = m->symbol();
pen = symbol.pen();
cache.markerSymbolPenColors.insert(key, new QColor(pen.color()));
pen.setColor(color(pen.color(), MarkerSymbol, key));
symbol.setPen(pen);
QBrush brush = symbol.brush();
cache.markerSymbolBrushColors.insert(key, new QColor(brush.color()));
brush.setColor(color(brush.color(), MarkerSymbol, key));
symbol.setBrush(brush);
m->setSymbol(symbol);
}
}