本文整理汇总了C++中QwtLegendItem::isUpdatesEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtLegendItem::isUpdatesEnabled方法的具体用法?C++ QwtLegendItem::isUpdatesEnabled怎么用?C++ QwtLegendItem::isUpdatesEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtLegendItem
的用法示例。
在下文中一共展示了QwtLegendItem::isUpdatesEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateLegend
//! Update the widget that represents the curve on the legend
// this was adapted from QwtPlotCurve::updateLegend()
void HistogramItem::updateLegend( QwtLegend *legend ) const
{
if ( !legend )
return;
QwtPlotItem::updateLegend( legend );
QWidget *widget = legend->find( this );
if ( !widget || !widget->inherits( "QwtLegendItem" ) )
return;
QwtLegendItem *legendItem = ( QwtLegendItem * )widget;
#if QT_VERSION < 0x040000
const bool doUpdate = legendItem->isUpdatesEnabled();
#else
const bool doUpdate = legendItem->updatesEnabled();
#endif
legendItem->setUpdatesEnabled( false );
const int policy = legend->displayPolicy();
if ( policy == QwtLegend::FixedIdentifier )
{
int mode = legend->identifierMode();
legendItem->setCurvePen( QPen( color() ) );
if ( mode & QwtLegendItem::ShowText )
legendItem->setText( title() );
else
legendItem->setText( QwtText() );
legendItem->setIdentifierMode( mode );
}
else if ( policy == QwtLegend::AutoIdentifier )
{
int mode = 0;
legendItem->setCurvePen( QPen( color() ) );
mode |= QwtLegendItem::ShowLine;
if ( !title().isEmpty() )
{
legendItem->setText( title() );
mode |= QwtLegendItem::ShowText;
}
else
{
legendItem->setText( QwtText() );
}
legendItem->setIdentifierMode( mode );
}
legendItem->setUpdatesEnabled( doUpdate );
legendItem->update();
}
示例2: updateLegend
//! Update the widget that represents the curve on the legend
void QwtPolarCurve::updateLegend( QwtLegend *legend ) const
{
if ( !legend )
return;
QwtPolarItem::updateLegend( legend );
QWidget *widget = legend->find( this );
if ( !widget || !widget->inherits( "QwtLegendItem" ) )
return;
QwtLegendItem *legendItem = ( QwtLegendItem * )widget;
#if QT_VERSION < 0x040000
const bool doUpdate = legendItem->isUpdatesEnabled();
#else
const bool doUpdate = legendItem->updatesEnabled();
#endif
legendItem->setUpdatesEnabled( false );
const int policy = legend->displayPolicy();
if ( policy == QwtLegend::FixedIdentifier )
{
int mode = legend->identifierMode();
if ( mode & QwtLegendItem::ShowLine )
legendItem->setCurvePen( pen() );
if ( mode & QwtLegendItem::ShowSymbol )
legendItem->setSymbol( symbol() );
if ( mode & QwtLegendItem::ShowText )
legendItem->setText( title() );
else
legendItem->setText( QwtText() );
legendItem->setIdentifierMode( mode );
}
else if ( policy == QwtLegend::AutoIdentifier )
{
int mode = 0;
if ( QwtPolarCurve::NoCurve != style() )
{
legendItem->setCurvePen( pen() );
mode |= QwtLegendItem::ShowLine;
}
if ( QwtSymbol::NoSymbol != symbol().style() )
{
legendItem->setSymbol( symbol() );
mode |= QwtLegendItem::ShowSymbol;
}
if ( !title().isEmpty() )
{
legendItem->setText( title() );
mode |= QwtLegendItem::ShowText;
}
else
{
legendItem->setText( QwtText() );
}
legendItem->setIdentifierMode( mode );
}
legendItem->setUpdatesEnabled( doUpdate );
legendItem->update();
}