本文整理汇总了C++中QTextFormat::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextFormat::property方法的具体用法?C++ QTextFormat::property怎么用?C++ QTextFormat::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextFormat
的用法示例。
在下文中一共展示了QTextFormat::property方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawObject
//![1]
void SvgTextObject::drawObject(QPainter *painter, const QRectF &rect,
QTextDocument * /*doc*/, int /*posInDocument*/,
const QTextFormat &format)
{
QImage bufferedImage = qVariantValue<QImage>(format.property(Window::SvgData));
painter->drawImage(rect, bufferedImage);
}
示例2: drawObject
void CaretInterface::drawObject(QPainter *painter, const QRectF &rect, QTextDocument *, int, const QTextFormat &format)
{
painter->setRenderHint(QPainter::Antialiasing, true);
int c = format.property(Color).toInt();
QColor color(c & 0xff, (c & 0xff00) / 0x100, (c & 0xff0000) / 0x10000);
QString text = format.property(Text).toString();
painter->setFont(m_font);
// painter->fillRect(rect, QBrush(color));
painter->setBrush(QBrush(color));
painter->setPen(QPen(Qt::NoPen));
QRectF r2( rect.x(), rect.y() + 2, rect.width(), rect.height() + 2);
painter->drawRoundedRect(r2, 3, 3);
painter->setPen(QPen(Qt::white));
QRectF r( rect.x() + 2, rect.y() + 3, rect.width() - 4, rect.height() - 2);
painter->drawText(r, text);
painter->setRenderHint(QPainter::Antialiasing, false);
}
示例3: QPoint
void
WidgetTextObject::drawObject(QPainter *painter, const QRectF &rect, QTextDocument * /*doc*/, int /*posInDocument*/, const QTextFormat &format)
{
QWidget* widget = qVariantValue<QWidget*>(format.property( 1 ));
widget->render( painter, QPoint( 0, 0 ));
//Adjusted to allow for the margin
QRect contentsRect = rect.toRect().adjusted(0, 0, -kMargin.width(), -kMargin.height());
m_widgetRects[widget] = contentsRect;
}
示例4: intrinsicSize
//![0]
QSizeF SvgTextObject::intrinsicSize(QTextDocument * /*doc*/, int /*posInDocument*/,
const QTextFormat &format)
{
QImage bufferedImage = qVariantValue<QImage>(format.property(Window::SvgData));
QSize size = bufferedImage.size();
if (size.height() > 25)
size *= 25.0 / (double) size.height();
return QSizeF(size);
}
示例5: formatDifference
QTextFormat HtmlExporter::formatDifference( const QTextFormat &from, const QTextFormat &to )
{
//kDebug();
QTextFormat diff = to;
const QMap<int, QVariant> props = to.properties();
for ( QMap<int, QVariant>::ConstIterator it = props.begin(), end = props.end();
it != end; ++it )
if ( it.value() == from.property( it.key() ) )
diff.clearProperty( it.key() );
return diff;
}
示例6: QSizeF
QSizeF
WidgetTextObject::intrinsicSize(QTextDocument*, int /*posInDocument*/, const QTextFormat& format)
{
QWidget* widget = qVariantValue<QWidget*>(format.property(1));
return QSizeF( widget->size() + kMargin );
}
示例7: intrinsicSize
QSizeF CaretInterface::intrinsicSize(QTextDocument *, int,
const QTextFormat &format)
{
return format.property(Size).toSizeF();
}