/*! \brief Initializes a QwtPlot instance \param title Title text */ void QwtPlot::initPlot( const QwtText &title ) { d_data = new PrivateData; d_data->layout = new QwtPlotLayout; d_data->autoReplot = false; // title d_data->titleLabel = new QwtTextLabel( this ); d_data->titleLabel->setObjectName( "QwtPlotTitle" ); d_data->titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) ); QwtText text( title ); text.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap ); d_data->titleLabel->setText( text ); // legend d_data->legend = NULL; // axis initAxesData(); // canvas d_data->canvas = new QwtPlotCanvas( this ); d_data->canvas->setObjectName( "QwtPlotCanvas" ); d_data->canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); d_data->canvas->setLineWidth( 2 ); updateTabOrder(); setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); resize( 200, 200 ); }
/*! \brief Initializes a QwtPlot instance \param title Title text */ void QwtPlot::initPlot( const QwtText &title ) { d_data = new PrivateData; d_data->layout = new QwtPlotLayout; d_data->autoReplot = false; // title d_data->titleLabel = new QwtTextLabel( this ); d_data->titleLabel->setObjectName( "QwtPlotTitle" ); d_data->titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) ); QwtText text( title ); text.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap ); d_data->titleLabel->setText( text ); // footer d_data->footerLabel = new QwtTextLabel( this ); d_data->footerLabel->setObjectName( "QwtPlotFooter" ); QwtText footer; footer.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap ); d_data->footerLabel->setText( footer ); // legend d_data->legend = NULL; // axis initAxesData(); // canvas d_data->canvas = new QwtPlotCanvas( this ); d_data->canvas->setObjectName( "QwtPlotCanvas" ); d_data->canvas->installEventFilter( this ); setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); resize( 200, 200 ); QList<QWidget *> focusChain; focusChain << this << d_data->titleLabel << axisWidget( xTop ) << axisWidget( yLeft ) << d_data->canvas << axisWidget( yRight ) << axisWidget( xBottom ) << d_data->footerLabel; for ( int i = 0; i < focusChain.size() - 1; i++ ) qwtSetTabOrder( focusChain[i], focusChain[i+1], false ); qwtEnableLegendItems( this, true ); }