本文整理汇总了C++中QTextFrameFormat::border方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextFrameFormat::border方法的具体用法?C++ QTextFrameFormat::border怎么用?C++ QTextFrameFormat::border使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextFrameFormat
的用法示例。
在下文中一共展示了QTextFrameFormat::border方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitFrame
void HtmlExporter::emitFrame( QTextFrame::Iterator frameIt )
{
// kDebug() << "html" << html;
if ( !frameIt.atEnd() ) {
QTextFrame::Iterator next = frameIt;
++next;
if ( next.atEnd()
&& frameIt.currentFrame() == 0
&& frameIt.parentFrame() != doc->rootFrame()
&& frameIt.currentBlock().begin().atEnd() ) {
return;
}
}
for ( QTextFrame::Iterator it = frameIt;
!it.atEnd(); ++it ) {;
if ( QTextFrame *f = it.currentFrame() ) {
// qDebug() << "Its a frame, not a block" << endl;
if ( QTextTable * table = qobject_cast<QTextTable *>( f ) ) {
emitTable( table );
} else {
// qDebug() << "isn't table" << endl;
html += QLatin1String( "\n<table" );
QTextFrameFormat format = f->frameFormat();
if ( format.hasProperty( QTextFormat::FrameBorder ) ) {
emitAttribute( "border", QString::number( format.border() ) );
}
html += QLatin1String( " style=\"-qt-table-type: frame;" );
emitFloatStyle( format.position(), OmitStyleTag );
if ( format.hasProperty( QTextFormat::FrameMargin ) ) {
const QString margin = QString::number( format.margin() );
emitMargins( margin, margin, margin, margin );
}
html += QLatin1Char( '\"' );
emitTextLength( "width", format.width() );
emitTextLength( "height", format.height() );
QBrush bg = format.background();
if ( bg != Qt::NoBrush ) {
emitAttribute( "bgcolor", bg.color().name() );
}
html += QLatin1Char( '>' );
html += QLatin1String( "\n<tr>\n<td style=\"border: none;\">" );
emitFrame( f->begin() );
html += QLatin1String( "</td></tr></table>" );
}
} else if ( it.currentBlock().isValid() ) {
// qDebug()<< "is valid" << endl;
emitBlock( it.currentBlock() );
}
}
}
示例2: addFrameDecorations
void QQuickTextNodeEngine::addFrameDecorations(QTextDocument *document, QTextFrame *frame)
{
QTextDocumentLayout *documentLayout = qobject_cast<QTextDocumentLayout *>(document->documentLayout());
QTextFrameFormat frameFormat = frame->format().toFrameFormat();
QTextTable *table = qobject_cast<QTextTable *>(frame);
QRectF boundingRect = table == 0
? documentLayout->frameBoundingRect(frame)
: documentLayout->tableBoundingRect(table);
QBrush bg = frame->frameFormat().background();
if (bg.style() != Qt::NoBrush)
m_backgrounds.append(qMakePair(boundingRect, bg.color()));
if (!frameFormat.hasProperty(QTextFormat::FrameBorder))
return;
qreal borderWidth = frameFormat.border();
if (qFuzzyIsNull(borderWidth))
return;
QBrush borderBrush = frameFormat.borderBrush();
QTextFrameFormat::BorderStyle borderStyle = frameFormat.borderStyle();
if (borderStyle == QTextFrameFormat::BorderStyle_None)
return;
addBorder(boundingRect.adjusted(frameFormat.leftMargin(), frameFormat.topMargin(),
-frameFormat.rightMargin(), -frameFormat.bottomMargin()),
borderWidth, borderStyle, borderBrush);
if (table != 0) {
int rows = table->rows();
int columns = table->columns();
for (int row=0; row<rows; ++row) {
for (int column=0; column<columns; ++column) {
QTextTableCell cell = table->cellAt(row, column);
QRectF cellRect = documentLayout->tableCellBoundingRect(table, cell);
addBorder(cellRect.adjusted(-borderWidth, -borderWidth, 0, 0), borderWidth,
borderStyle, borderBrush);
}
}
}
}