本文整理汇总了C++中SourceItem::jumpCount方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceItem::jumpCount方法的具体用法?C++ SourceItem::jumpCount怎么用?C++ SourceItem::jumpCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceItem
的用法示例。
在下文中一共展示了SourceItem::jumpCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintArrows
void SourceItemDelegate::paintArrows(QPainter *p,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QTreeWidget *lv = _parent;
if ( !lv ) return;
SourceView* sv = (SourceView*) lv;
SourceItem* item = static_cast<SourceItem*>(index.internalPointer());
const QRect& rect = option.rect;
int height = rect.height();
p->save();
drawBackground(p, option, index);
p->translate(rect.topLeft());
int marg = 1;
int yy = height/2, y1, y2;
QColor c;
int start = -1, end = -1;
TraceLineJump* lineJump = item->lineJump();
uint lineno = item->lineno();
TraceLineCall* lineCall = item->lineCall();
// draw line borders, detect start/stop of a line
for(int i=0; i< item->jumpCount(); i++) {
TraceLineJump* jump = item->jump(i);
if (jump == 0) continue;
y1 = 0;
y2 = height;
if (lineJump &&
(lineJump->lineTo() == jump->lineTo()) &&
(jump->lineFrom()->lineno() == lineno)) {
if (start<0) start = i;
if (lineJump == jump) {
if (jump->lineTo()->lineno() <= lineno)
y2 = yy;
else
y1 = yy;
}
}
else if (!lineJump && !lineCall &&
(jump->lineTo()->lineno() == lineno)) {
if (end<0) end = i;
if (jump->lineFrom()->lineno() < lineno)
y2 = yy;
else
y1 = yy;
}
c = jump->isCondJump() ? Qt::red : Qt::blue;
p->fillRect( marg + 6*i, y1, 4, y2, c);
p->setPen(c.light());
p->drawLine( marg + 6*i, y1, marg + 6*i, y2);
p->setPen(c.dark());
p->drawLine( marg + 6*i +3, y1, marg + 6*i +3, y2);
}
// draw start/stop horizontal line
int x, y = yy-2, w, h = 4;
if (start >= 0) {
c = item->jump(start)->isCondJump() ? Qt::red : Qt::blue;
x = marg + 6*start;
w = 6*(sv->arrowLevels() - start) + 10;
p->fillRect( x, y, w, h, c);
p->setPen(c.light());
p->drawLine(x, y, x+w-1, y);
p->drawLine(x, y, x, y+h-1);
p->setPen(c.dark());
p->drawLine(x+w-1, y, x+w-1, y+h-1);
p->drawLine(x+1, y+h-1, x+w-1, y+h-1);
}
if (end >= 0) {
c = item->jump(end)->isCondJump() ? Qt::red : Qt::blue;
x = marg + 6*end;
w = 6*(sv->arrowLevels() - end) + 10;
QPolygon a;
a.putPoints(0, 8, x,y+h,
x,y, x+w-8,y, x+w-8,y-2,
x+w,yy,
x+w-8,y+h+2, x+w-8,y+h,
x,y+h);
p->setBrush(c);
p->drawConvexPolygon(a);
p->setPen(c.light());
p->drawPolyline(a.constData(), 5);
p->setPen(c.dark());
p->drawPolyline(a.constData() + 4, 2);
p->setPen(c.light());
p->drawPolyline(a.constData() + 5, 2);
p->setPen(c.dark());
p->drawPolyline(a.constData() + 6, 2);
}
// draw inner vertical line for start/stop
//.........这里部分代码省略.........