改进代码
This commit is contained in:
@@ -21,7 +21,7 @@ public:
|
||||
legendMode( QwtPlotBarChart::LegendChartTitle )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
~PrivateData()
|
||||
{
|
||||
delete symbol;
|
||||
@@ -120,7 +120,7 @@ void QwtPlotBarChart::setSamples( QwtSeriesData<QPointF> *data )
|
||||
\brief Assign a symbol
|
||||
|
||||
The bar chart will take the ownership of the symbol, hence the previously
|
||||
set symbol will be delete by setting a new one. If \p symbol is
|
||||
set symbol will be delete by setting a new one. If \p symbol is
|
||||
\c NULL no symbol will be drawn.
|
||||
|
||||
\param symbol Symbol
|
||||
@@ -304,7 +304,7 @@ void QwtPlotBarChart::drawSample( QPainter *painter,
|
||||
}
|
||||
|
||||
/*!
|
||||
Draw a bar
|
||||
Draw a bar
|
||||
|
||||
\param painter Painter
|
||||
\param sampleIndex Index of the sample represented by the bar
|
||||
@@ -312,10 +312,10 @@ void QwtPlotBarChart::drawSample( QPainter *painter,
|
||||
\param rect Bounding rectangle of the bar
|
||||
*/
|
||||
void QwtPlotBarChart::drawBar( QPainter *painter,
|
||||
int sampleIndex, const QPointF &sample,
|
||||
int sampleIndex, const QPointF &sample,
|
||||
const QwtColumnRect &rect ) const
|
||||
{
|
||||
const QwtColumnSymbol *specialSym =
|
||||
const QwtColumnSymbol *specialSym =
|
||||
specialSymbol( sampleIndex, sample );
|
||||
|
||||
const QwtColumnSymbol *sym = specialSym;
|
||||
@@ -329,17 +329,17 @@ void QwtPlotBarChart::drawBar( QPainter *painter,
|
||||
else
|
||||
{
|
||||
// we build a temporary default symbol
|
||||
QwtColumnSymbol sym( QwtColumnSymbol::Box );
|
||||
sym.setLineWidth( 1 );
|
||||
sym.setFrameStyle( QwtColumnSymbol::Plain );
|
||||
sym.draw( painter, rect );
|
||||
QwtColumnSymbol columnSymbol( QwtColumnSymbol::Box );
|
||||
columnSymbol.setLineWidth( 1 );
|
||||
columnSymbol.setFrameStyle( QwtColumnSymbol::Plain );
|
||||
columnSymbol.draw( painter, rect );
|
||||
}
|
||||
|
||||
delete specialSym;
|
||||
}
|
||||
|
||||
/*!
|
||||
Needs to be overloaded to return a
|
||||
Needs to be overloaded to return a
|
||||
non default symbol for a specific sample
|
||||
|
||||
\param sampleIndex Index of the sample represented by the bar
|
||||
@@ -347,7 +347,7 @@ void QwtPlotBarChart::drawBar( QPainter *painter,
|
||||
|
||||
\return NULL, indicating to use the default symbol
|
||||
*/
|
||||
QwtColumnSymbol *QwtPlotBarChart::specialSymbol(
|
||||
QwtColumnSymbol *QwtPlotBarChart::specialSymbol(
|
||||
int sampleIndex, const QPointF &sample ) const
|
||||
{
|
||||
Q_UNUSED( sampleIndex );
|
||||
@@ -428,13 +428,13 @@ QList<QwtLegendData> QwtPlotBarChart::legendData() const
|
||||
the bar corresponding to index - otherwise the bar
|
||||
displays the default symbol.
|
||||
|
||||
\param index Index of the legend entry
|
||||
\param index Index of the legend entry
|
||||
\param size Icon size
|
||||
|
||||
\sa setLegendMode(), drawBar(),
|
||||
\sa setLegendMode(), drawBar(),
|
||||
QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
|
||||
*/
|
||||
QwtGraphic QwtPlotBarChart::legendIcon(
|
||||
QwtGraphic QwtPlotBarChart::legendIcon(
|
||||
int index, const QSizeF &size ) const
|
||||
{
|
||||
QwtColumnRect column;
|
||||
@@ -452,7 +452,7 @@ QwtGraphic QwtPlotBarChart::legendIcon(
|
||||
int barIndex = -1;
|
||||
if ( d_data->legendMode == QwtPlotBarChart::LegendBarTitles )
|
||||
barIndex = index;
|
||||
|
||||
|
||||
drawBar( &painter, barIndex, QPointF(), column );
|
||||
|
||||
return icon;
|
||||
|
||||
Reference in New Issue
Block a user