本文整理汇总了C++中QwtGraphic::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtGraphic::isNull方法的具体用法?C++ QwtGraphic::isNull怎么用?C++ QwtGraphic::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtGraphic
的用法示例。
在下文中一共展示了QwtGraphic::isNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: minimumSize
/*!
Minimum size hint needed to display an entry
\param data Attributes of the legend entry
\return Minimum size
*/
QSize QwtPlotLegendItem::minimumSize( const QwtLegendData &data ) const
{
QSize size( 2 * d_data->itemMargin, 2 * d_data->itemMargin );
if ( !data.isValid() )
return size;
const QwtGraphic graphic = data.icon();
const QwtText text = data.title();
int w = 0;
int h = 0;
if ( !graphic.isNull() )
{
w = graphic.width();
h = graphic.height();
}
if ( !text.isEmpty() )
{
const QSizeF sz = text.textSize( font() );
w += qCeil( sz.width() );
h = qMax( h, qCeil( sz.height() ) );
}
if ( graphic.width() > 0 && !text.isEmpty() )
w += d_data->itemSpacing;
size += QSize( w, h );
return size;
}
示例2: title
/*!
\brief Return all information, that is needed to represent
the item on the legend
Most items are represented by one entry on the legend
showing an icon and a text.
QwtLegendData is basically a list of QVariants that makes it
possible to overload and reimplement legendData() to
return almost any type of information, that is understood
by the receiver that acts as the legend.
The default implementation returns one entry with
the title() of the item and the legendIcon().
\sa title(), legendIcon(), QwtLegend
*/
QList<QwtLegendData> QwtPolarItem::legendData() const
{
QwtLegendData data;
QwtText label = title();
label.setRenderFlags( label.renderFlags() & Qt::AlignLeft );
QVariant titleValue;
qVariantSetValue( titleValue, label );
data.setValue( QwtLegendData::TitleRole, titleValue );
const QwtGraphic graphic = legendIcon( 0, legendIconSize() );
if ( !graphic.isNull() )
{
QVariant iconValue;
qVariantSetValue( iconValue, graphic );
data.setValue( QwtLegendData::IconRole, iconValue );
}
QList<QwtLegendData> list;
list += data;
return list;
}