本文整理汇总了C++中scaledFontPixelSize函数的典型用法代码示例。如果您正苦于以下问题:C++ scaledFontPixelSize函数的具体用法?C++ scaledFontPixelSize怎么用?C++ scaledFontPixelSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scaledFontPixelSize函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: scaledFontPixelSize
void QgsComposerUtils::drawText( QPainter *painter, const QRectF &rect, const QString &text, const QFont &font, const QColor &color, const Qt::AlignmentFlag halignment, const Qt::AlignmentFlag valignment, const int flags )
{
if ( !painter )
{
return;
}
//upscale using FONT_WORKAROUND_SCALE
//ref: http://osgeo-org.1560.x6.nabble.com/Multi-line-labels-and-font-bug-td4157152.html
QFont textFont = scaledFontPixelSize( font );
QRectF scaledRect( rect.x() * FONT_WORKAROUND_SCALE, rect.y() * FONT_WORKAROUND_SCALE,
rect.width() * FONT_WORKAROUND_SCALE, rect.height() * FONT_WORKAROUND_SCALE );
painter->save();
painter->setFont( textFont );
if ( color.isValid() )
{
painter->setPen( color );
}
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
painter->scale( scaleFactor, scaleFactor );
painter->drawText( scaledRect, halignment | valignment | flags, text );
painter->restore();
}
开发者ID:dakcarto,项目名称:QGIS,代码行数:25,代码来源:qgscomposerutils.cpp
示例2: scaledFontPixelSize
double QgsLayoutUtils::fontAscentMM( const QFont &font )
{
//upscale using FONT_WORKAROUND_SCALE
//ref: http://osgeo-org.1560.x6.nabble.com/Multi-line-labels-and-font-bug-td4157152.html
QFont metricsFont = scaledFontPixelSize( font );
QFontMetricsF fontMetrics( metricsFont );
return ( fontMetrics.ascent() / FONT_WORKAROUND_SCALE );
}
开发者ID:cz172638,项目名称:QGIS,代码行数:8,代码来源:qgslayoututils.cpp
示例3: scaledFontPixelSize
void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize( font );
p->save();
p->setFont( textFont );
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale( scaleFactor, scaleFactor );
p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );
p->restore();
}
开发者ID:VladimirZhandarov,项目名称:QGIS,代码行数:11,代码来源:qgscomposeritem.cpp
示例4: scaledFontPixelSize
void QgsDecorationGrid::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize( font );
p->save();
p->setFont( textFont );
p->setPen( QColor( 0, 0, 0 ) ); //draw text always in black
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale( scaleFactor, scaleFactor );
p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );
p->restore();
}
开发者ID:AM7000000,项目名称:QGIS,代码行数:12,代码来源:qgsdecorationgrid.cpp
注:本文中的scaledFontPixelSize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论