本文整理汇总了C++中QListIterator::toFront方法的典型用法代码示例。如果您正苦于以下问题:C++ QListIterator::toFront方法的具体用法?C++ QListIterator::toFront怎么用?C++ QListIterator::toFront使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListIterator
的用法示例。
在下文中一共展示了QListIterator::toFront方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintEvent
void GraphicWidget::paintEvent( QPaintEvent* event )
{
int geomX;
int geomY;
float scale;
float min;
float max;
float value;
float prev;
QPen pen;
QPainter painter ( this );
pen.setWidth( 2 );
min = 999999999;
max = 0;
geomY = this->height();
geomX = this->width();
for ( int i=asks.size();i>geomY/10;i--)
asks.removeLast();
for ( int i=bids.size();i>geomY/10;i--)
bids.removeLast();
for ( int i=trades.size();i>geomY/10;i--)
trades.removeLast();
QListIterator<float> asksIterator ( asks );
while ( asksIterator.hasNext() )
{
value = asksIterator.next();
if ( value > max )
max = value;
if ( value < min )
min = value;
}
QListIterator<float> bidsIterator ( bids );
while ( bidsIterator.hasNext() )
{
value = bidsIterator.next();
if ( value > max )
max = value;
if ( value < min )
min = value;
}
QListIterator<float> tradesIterator ( trades );
while ( tradesIterator.hasNext() )
{
value = tradesIterator.next();
if ( value > max )
max = value;
if ( value < min )
min = value;
}
min = floor ( min );
if ( max - min > 0.5 )
max = floor ( max ) + 1;
else
max = floor ( max ) + 0.5;
scale = geomX/( max - min );
if ( bids.size() >= 2 )
{
bidsIterator.toFront();
geomY = 1;
pen.setColor ( Qt::blue );
painter.setPen ( pen );
value = bidsIterator.next ();
while ( bidsIterator.hasNext() )
{
prev = bidsIterator.peekPrevious();
value = bidsIterator.next ();
// painter.drawEllipse((value - min) * scale, geomY, 2, 2 );
painter.drawLine( ( prev - min ) * scale, geomY, (value - min) * scale, geomY + 10 );
geomY+=10;
}
}
if ( trades.size() >= 2 )
{
tradesIterator.toFront();
value = tradesIterator.next ();
geomY = 1;
pen.setColor ( Qt::green );
painter.setPen ( pen );
while ( tradesIterator.hasNext() )
{
prev = tradesIterator.peekPrevious();
value = tradesIterator.next ();
// painter.drawEllipse((value - min) * scale, geomY, 2, 2 );
painter.drawLine( (prev - min ) * scale , geomY, (value - min) * scale, geomY + 10 );
geomY+=10;
}
}
if ( asks.size() >= 2 )
{
asksIterator.toFront();
value = asksIterator.next ();
geomY = 1;
pen.setColor ( Qt::red );
painter.setPen ( pen );
//.........这里部分代码省略.........