本文整理汇总了C++中Marker::offset方法的典型用法代码示例。如果您正苦于以下问题:C++ Marker::offset方法的具体用法?C++ Marker::offset怎么用?C++ Marker::offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Marker
的用法示例。
在下文中一共展示了Marker::offset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
Marker::Marker(const Marker &marker):
QObject(marker.parent()),
m_offset(marker.offset()),
m_width(marker.width()),
m_height(marker.height()),
m_id(marker.id()),
m_above(marker.above()),
m_below(marker.below())
{
}
示例2: paintText
void KompareListViewLineItem::paintText( QPainter* p, const QColor& bg, int column, int width, int align )
{
if ( column == COL_MAIN )
{
QString textChunk;
int offset = ITEM_MARGIN;
int prevValue = 0;
int charsDrawn = 0;
int chunkWidth;
QBrush changeBrush( bg, Qt::Dense3Pattern );
QBrush normalBrush( bg, Qt::SolidPattern );
QBrush brush;
if ( m_text->string().isEmpty() )
{
p->fillRect( 0, 0, width, paintHeight(), normalBrush );
return;
}
p->fillRect( 0, 0, offset, paintHeight(), normalBrush );
if ( !m_text->markerList().isEmpty() )
{
MarkerListConstIterator markerIt = m_text->markerList().begin();
MarkerListConstIterator mEnd = m_text->markerList().end();
Marker* m = *markerIt;
for ( ; markerIt != mEnd; ++markerIt )
{
m = *markerIt;
textChunk = m_text->string().mid( prevValue, m->offset() - prevValue );
// qCDebug(KOMPAREPART) << "TextChunk = \"" << textChunk << "\"" ;
// qCDebug(KOMPAREPART) << "c->offset() = " << c->offset() ;
// qCDebug(KOMPAREPART) << "prevValue = " << prevValue ;
expandTabs(textChunk, kompareListView()->settings()->m_tabToNumberOfSpaces, charsDrawn);
charsDrawn += textChunk.length();
prevValue = m->offset();
if ( m->type() == Marker::End )
{
QFont font( p->font() );
font.setBold( true );
p->setFont( font );
// p->setPen( Qt::blue );
brush = changeBrush;
}
else
{
QFont font( p->font() );
font.setBold( false );
p->setFont( font );
// p->setPen( Qt::black );
brush = normalBrush;
}
chunkWidth = p->fontMetrics().width( textChunk );
p->fillRect( offset, 0, chunkWidth, paintHeight(), brush );
p->drawText( offset, 0,
chunkWidth, paintHeight(),
align, textChunk );
offset += chunkWidth;
}
}
if ( prevValue < m_text->string().length() )
{
// Still have to draw some string without changes
textChunk = m_text->string().mid( prevValue, qMax( 1, m_text->string().length() - prevValue ) );
expandTabs(textChunk, kompareListView()->settings()->m_tabToNumberOfSpaces, charsDrawn);
// qCDebug(KOMPAREPART) << "TextChunk = \"" << textChunk << "\"" ;
QFont font( p->font() );
font.setBold( false );
p->setFont( font );
chunkWidth = p->fontMetrics().width( textChunk );
p->fillRect( offset, 0, chunkWidth, paintHeight(), normalBrush );
p->drawText( offset, 0,
chunkWidth, paintHeight(),
align, textChunk );
offset += chunkWidth;
}
p->fillRect( offset, 0, width - offset, paintHeight(), normalBrush );
}
else
{
p->fillRect( 0, 0, width, paintHeight(), bg );
p->drawText( ITEM_MARGIN, 0,
width - ITEM_MARGIN, paintHeight(),
align, text( column ) );
}
}