本文整理汇总了C++中QwtGraphic::controlPointRect方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtGraphic::controlPointRect方法的具体用法?C++ QwtGraphic::controlPointRect怎么用?C++ QwtGraphic::controlPointRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtGraphic
的用法示例。
在下文中一共展示了QwtGraphic::controlPointRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qwtScaledBoundingRect
static inline QRectF qwtScaledBoundingRect(
const QwtGraphic &graphic, const QSizeF size )
{
QSizeF scaledSize = size;
if ( scaledSize.isEmpty() )
scaledSize = graphic.defaultSize();
const QSizeF sz = graphic.controlPointRect().size();
double sx = 1.0;
if ( sz.width() > 0.0 )
sx = scaledSize.width() / sz.width();
double sy = 1.0;
if ( sz.height() > 0.0 )
sy = scaledSize.height() / sz.height();
return graphic.scaledBoundingRect( sx, sy );
}
示例2: qwtDrawGraphicSymbols
static inline void qwtDrawGraphicSymbols( QPainter *painter,
const QPointF *points, int numPoints, const QwtGraphic &graphic,
const QwtSymbol &symbol )
{
const QRectF pointRect = graphic.controlPointRect();
if ( pointRect.isEmpty() )
return;
double sx = 1.0;
double sy = 1.0;
const QSize sz = symbol.size();
if ( sz.isValid() )
{
sx = sz.width() / pointRect.width();
sy = sz.height() / pointRect.height();
}
QPointF pinPoint = pointRect.center();
if ( symbol.isPinPointEnabled() )
pinPoint = symbol.pinPoint();
const QTransform transform = painter->transform();
for ( int i = 0; i < numPoints; i++ )
{
QTransform tr = transform;
tr.translate( points[i].x(), points[i].y() );
tr.scale( sx, sy );
tr.translate( -pinPoint.x(), -pinPoint.y() );
painter->setTransform( tr );
graphic.render( painter );
}
painter->setTransform( transform );
}