本文整理汇总了C++中QwtPlotCanvas::setAutoFillBackground方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCanvas::setAutoFillBackground方法的具体用法?C++ QwtPlotCanvas::setAutoFillBackground怎么用?C++ QwtPlotCanvas::setAutoFillBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCanvas
的用法示例。
在下文中一共展示了QwtPlotCanvas::setAutoFillBackground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initQwtPlot
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void StatsGenMDFWidget::initQwtPlot(QString xAxisName, QString yAxisName, QwtPlot* plot)
{
QPalette pal;
pal.setColor(QPalette::Text, Qt::white);
pal.setColor(QPalette::Foreground, Qt::white);
pal.setColor(QPalette::Window, Qt::black);
plot->setPalette( pal );
plot->plotLayout()->setAlignCanvasToScales( true );
for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
{
plot->axisWidget( axis )->setMargin( 0 );
plot->axisWidget(axis)->setPalette(pal);
}
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setAutoFillBackground( false );
canvas->setFrameStyle( QFrame::NoFrame );
canvas->setPalette(pal);
plot->setCanvas( canvas );
QFont font;
font.setBold(true);
QwtText xAxis(xAxisName);
xAxis.setColor(Qt::white);
xAxis.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop );
xAxis.setFont(font);
QwtText yAxis(yAxisName);
yAxis.setColor(Qt::white);
yAxis.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop );
yAxis.setFont(font);
const int margin = 5;
plot->setContentsMargins( margin, margin, margin, margin );
plot->setAxisTitle(QwtPlot::xBottom, xAxis);
plot->setAxisTitle(QwtPlot::yLeft, yAxis);
}
示例2: QwtPlotCanvas
PlotZoz::PlotZoz(QWidget *)
{
// Прозрачность полотна
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setFrameStyle(QFrame::NoFrame);
canvas->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
canvas->setPaintAttribute(QwtPlotCanvas::Opaque, false);
canvas->setAttribute(Qt::WA_OpaquePaintEvent, false);
canvas->setAutoFillBackground( false );
setCanvas(canvas);
plotLayout()->setAlignCanvasToScales(true);
// Отключаем щкалы деления
for (int i=0; i<QwtPlot::axisCnt; i++) {
axisScaleDraw(i)->enableComponent(QwtScaleDraw::Ticks, false);
axisScaleDraw(i)->enableComponent(QwtScaleDraw::Backbone, false);
}
pltSpectrogram = new PlotSpectr();
pltRasterData = new PlotRasterData();
pltGrid = new QwtPlotGrid;
pltGrid->enableXMin(true); // разрешаем отображение линий сетки, соответствующих вспомогательным делениям нижней шкалы
pltGrid->enableYMin(true); // разрешаем отображение линий сетки, соответствующих вспомогательным делениям нижней шкалы
pltGrid->setMajorPen(QPen(Qt::gray,0,Qt::DotLine)); // черный для основных делений
pltGrid->setMinorPen(QPen(Qt::gray,0,Qt::DotLine)); // серый для вспомогательных
pltGrid->attach(this);
setAxisMaxMajor(0,20);
setAxisMaxMinor(0,0);
setAxisMaxMajor(1,20);
setAxisMaxMinor(1,0);
setAxisMaxMajor(2,20);
setAxisMaxMinor(2,0);
setAxisMaxMajor(3,20);
setAxisMaxMinor(3,0);
canvas->setCursor(Qt::ArrowCursor);
setMouseTracking(true);
for (int i=0; i<QwtPlot::axisCnt; i++)
axisWidget(i)->setMouseTracking(true);
}
示例3: title
Plot::Plot( QWidget *parent ):
QwtPlot( parent)
{
setPalette( Qt::black );
// we want to have the axis scales like a frame around the
// canvas
plotLayout()->setAlignCanvasToScales( true );
for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
axisWidget( axis )->setMargin( 0 );
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setAutoFillBackground( false );
canvas->setFrameStyle( QFrame::NoFrame );
setCanvas( canvas );
setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
// a title
QwtText title( "Picker Demo" );
title.setColor( Qt::white );
title.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop );
QFont font;
font.setBold( true );
title.setFont( font );
QwtPlotTextLabel *titleItem = new QwtPlotTextLabel();
titleItem->setText( title );
titleItem->attach( this );
#if 1
// section
//QColor c( "PaleVioletRed" );
QwtPlotZoneItem* zone = new QwtPlotZoneItem();
zone->setPen( Qt::darkGray );
zone->setBrush( QColor( "#834358" ) );
zone->setOrientation( Qt::Horizontal );
zone->setInterval( 3.8, 5.7 );
zone->attach( this );
#else
// grid
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setMajorPen( Qt::white, 0, Qt::DotLine );
grid->setMinorPen( Qt::gray, 0 , Qt::DotLine );
grid->attach( this );
#endif
// curves
QPolygonF points1;
points1 << QPointF( 0.2, 4.4 ) << QPointF( 1.2, 3.0 )
<< QPointF( 2.7, 4.5 ) << QPointF( 3.5, 6.8 )
<< QPointF( 4.7, 7.9 ) << QPointF( 5.8, 7.1 );
insertCurve( "Curve 1", "DarkOrange", points1 );
QPolygonF points2;
points2 << QPointF( 0.4, 8.7 ) << QPointF( 1.4, 7.8 )
<< QPointF( 2.3, 5.5 ) << QPointF( 3.3, 4.1 )
<< QPointF( 4.4, 5.2 ) << QPointF( 5.6, 5.7 );
insertCurve( "Curve 2", "DodgerBlue", points2 );
CurveTracker* tracker = new CurveTracker( this->canvas() );
// for the demo we want the tracker to be active without
// having to click on the canvas
tracker->setStateMachine( new QwtPickerTrackerMachine() );
tracker->setRubberBandPen( QPen( "MediumOrchid" ) );
}