本文整理汇总了C++中QTextImageFormat::stringProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextImageFormat::stringProperty方法的具体用法?C++ QTextImageFormat::stringProperty怎么用?C++ QTextImageFormat::stringProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextImageFormat
的用法示例。
在下文中一共展示了QTextImageFormat::stringProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitFragment
void HtmlExporter::emitFragment( const QTextFragment &fragment, const QTextBlockFormat &blockFormat )
{
// kDebug() << "html" << html;
const QTextCharFormat format = fragment.charFormat();
bool closeAnchor = false;
bool anchorIsOpen = false;
if ( format.isAnchor() ) {
// const QStringList names = format.anchorNames();
// if (!names.isEmpty()) {
// html += QLatin1String("<a name=\"");
// html += names.at(0);
// html += QLatin1String("\" ");
// anchorIsOpen = true;
// }
const QString href = format.anchorHref();
if ( !href.isEmpty() ) {
// if (!anchorIsOpen) {
// html += QLatin1String("<a ");
// anchorIsOpen = true;
// }
html += QLatin1String( "<a href=\"" );
html += href;
html += QLatin1String( "\"" );
anchorIsOpen = true;
// closeAnchor = true;
// html += QLatin1String("\"");
}
if ( format.hasProperty( BilboTextFormat::AnchorTitle ) ) {
const QString title = format.stringProperty( BilboTextFormat::AnchorTitle );
if ( !title.isEmpty() ) {
html += QLatin1String( " title=\"" );
html += title;
html += QLatin1String( "\"" );
}
}
if ( format.hasProperty( BilboTextFormat::AnchorTarget ) ) {
const QString target = format.stringProperty( BilboTextFormat::AnchorTarget );
if ( !target.isEmpty() ) {
html += QLatin1String( " target=\"" );
html += target;
html += QLatin1String( "\"" );
}
}
if ( anchorIsOpen ) {
html += QLatin1String( ">" );
closeAnchor = true;
}
}
QList<tag> tags = emitCharFormatStyle( format, blockFormat );
// if ( !format.anchorHref().isNull() ) {
// html += QLatin1String(">");
// closeAnchor = true;
// }
// kDebug() << "tags count" << tags.count() << endl;
for ( int i = 0; i < tags.count(); ++i ) {
switch ( tags.at( i ) ) {
case span:
break; //Jump
// case h1:
// html += QLatin1String( "<h1>" );
// break;
// case h2:
// html += QLatin1String( "<h2>" );
// break;
// case h3:
// html += QLatin1String( "<h3>" );
// break;
// case h4:
// html += QLatin1String( "<h4>" );
// break;
// case h5:
// html += QLatin1String( "<h5>" );
// break;
case strong:
html += QLatin1String( "<strong>" );
break;
case em:
html += QLatin1String( "<em>" );
break;
case s:
html += QLatin1String( "<s>" );
break;
case u:
if ( !closeAnchor )
html += QLatin1String( "<u>" );
break;
case code:
html += QLatin1String( "<code>" );
break;
case sub:
html += QLatin1String( "<sub>" );
break;
case sup:
html += QLatin1String( "<sup>" );
break;
}
}
//.........这里部分代码省略.........