! \brief Initializes a QwtPlot instance \param title Title text */
| 133 | \param title Title text |
| 134 | */ |
| 135 | void QwtPlot::initPlot( const QwtText& title ) |
| 136 | { |
| 137 | m_data = new PrivateData; |
| 138 | |
| 139 | m_data->layout = new QwtPlotLayout; |
| 140 | m_data->autoReplot = false; |
| 141 | |
| 142 | // title |
| 143 | m_data->titleLabel = new QwtTextLabel( this ); |
| 144 | m_data->titleLabel->setObjectName( "QwtPlotTitle" ); |
| 145 | m_data->titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) ); |
| 146 | |
| 147 | QwtText text( title ); |
| 148 | text.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap ); |
| 149 | m_data->titleLabel->setText( text ); |
| 150 | |
| 151 | // footer |
| 152 | m_data->footerLabel = new QwtTextLabel( this ); |
| 153 | m_data->footerLabel->setObjectName( "QwtPlotFooter" ); |
| 154 | |
| 155 | QwtText footer; |
| 156 | footer.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap ); |
| 157 | m_data->footerLabel->setText( footer ); |
| 158 | |
| 159 | // legend |
| 160 | m_data->legend = NULL; |
| 161 | |
| 162 | // axes |
| 163 | initAxesData(); |
| 164 | |
| 165 | // canvas |
| 166 | m_data->canvas = new QwtPlotCanvas( this ); |
| 167 | m_data->canvas->setObjectName( "QwtPlotCanvas" ); |
| 168 | m_data->canvas->installEventFilter( this ); |
| 169 | |
| 170 | setSizePolicy( QSizePolicy::MinimumExpanding, |
| 171 | QSizePolicy::MinimumExpanding ); |
| 172 | |
| 173 | resize( 200, 200 ); |
| 174 | |
| 175 | using namespace QwtAxis; |
| 176 | |
| 177 | QList< QWidget* > focusChain; |
| 178 | focusChain << this << m_data->titleLabel << axisWidget( XTop ) |
| 179 | << axisWidget( YLeft ) << m_data->canvas |
| 180 | << axisWidget( YRight ) << axisWidget( XBottom ) |
| 181 | << m_data->footerLabel; |
| 182 | |
| 183 | for ( int i = 0; i < focusChain.size() - 1; i++ ) |
| 184 | qwtSetTabOrder( focusChain[i], focusChain[i + 1], false ); |
| 185 | |
| 186 | qwtEnableLegendItems( this, true ); |
| 187 | } |
| 188 | |
| 189 | /*! |
| 190 | \brief Set the drawing canvas of the plot widget |
nothing calls this directly
no test coverage detected