本文整理汇总了C++中QwtLegendItem::setItemMode方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtLegendItem::setItemMode方法的具体用法?C++ QwtLegendItem::setItemMode怎么用?C++ QwtLegendItem::setItemMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtLegendItem
的用法示例。
在下文中一共展示了QwtLegendItem::setItemMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateLegend
void QwtPlotItem::updateLegend(QwtLegend *legend) const
{
if ( !legend )
return;
QWidget *lgdItem = legend->find(this);
if ( testItemAttribute(QwtPlotItem::Legend) )
{
if ( lgdItem == NULL )
{
lgdItem = legendItem();
if ( lgdItem )
{
if ( lgdItem->inherits("QwtLegendItem") )
{
QwtLegendItem *label = (QwtLegendItem *)lgdItem;
label->setItemMode(legend->itemMode());
if ( d_data->plot )
{
QObject::connect(label, SIGNAL(clicked()),
d_data->plot, SLOT(legendItemClicked()));
QObject::connect(label, SIGNAL(checked(bool)),
d_data->plot, SLOT(legendItemChecked(bool)));
}
}
legend->insert(this, lgdItem);
}
示例2: legendItem
/*!
\brief Update the widget that represents the item on the legend
updateLegend() is called from itemChanged() to adopt the widget
representing the item on the legend to its new configuration.
The default implementation is made for QwtPolarCurve and updates a
QwtLegendItem(), but an item could be represented by any type of widget,
by overloading legendItem() and updateLegend().
\sa legendItem(), itemChanged(), QwtLegend()
*/
void QwtPolarItem::updateLegend( QwtLegend *legend ) const
{
if ( legend == NULL )
return;
QWidget *lgdItem = legend->find( this );
if ( testItemAttribute( QwtPolarItem::Legend ) )
{
if ( lgdItem == NULL )
{
lgdItem = legendItem();
if ( lgdItem )
legend->insert( this, lgdItem );
}
QwtLegendItem* label = qobject_cast<QwtLegendItem *>( lgdItem );
if ( label )
{
// paint the identifier
const QSize sz = label->identifierSize();
QPixmap identifier( sz.width(), sz.height() );
identifier.fill( Qt::transparent );
QPainter painter( &identifier );
painter.setRenderHint( QPainter::Antialiasing,
testRenderHint( QwtPolarItem::RenderAntialiased ) );
drawLegendIdentifier( &painter,
QRect( 0, 0, sz.width(), sz.height() ) );
painter.end();
const bool doUpdate = label->updatesEnabled();
if ( doUpdate )
label->setUpdatesEnabled( false );
label->setText( title() );
label->setIdentifier( identifier );
label->setItemMode( legend->itemMode() );
if ( doUpdate )
label->setUpdatesEnabled( true );
label->update();
}
}
else
{
if ( lgdItem )
{
lgdItem->hide();
lgdItem->deleteLater();
}
}
}