本文整理汇总了C++中QValueList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ QValueList::push_back方法的具体用法?C++ QValueList::push_back怎么用?C++ QValueList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QValueList
的用法示例。
在下文中一共展示了QValueList::push_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: restoreState
void EditorView::restoreState ( )
{
QString guiKeyPrefix ( "user/sw/kdbe/gui/" );
char buf[300];
kdbGetValueByParent ( guiKeyPrefix, "width", buf, 300 );
int vwidth = atoi ( buf );
kdbGetValueByParent ( guiKeyPrefix, "height", buf, 300 );
int vheight = atoi ( buf );
kdbGetValueByParent ( guiKeyPrefix, "x", buf, 300 );
int vx = atoi ( buf );
kdbGetValueByParent ( guiKeyPrefix, "y", buf, 300 );
int vy = atoi ( buf );
QValueList<int> splittersizes;
kdbGetValueByParent ( guiKeyPrefix + "splitter/", "left", buf, 300 );
int left = atoi ( buf );
kdbGetValueByParent ( guiKeyPrefix + "splitter/", "right", buf, 300 );
int right = atoi ( buf );
if ( left != 0 && right != 0 )
{
splittersizes.push_back ( left );
splittersizes.push_back ( right );
splitter->setSizes ( splittersizes );
}
if ( vx != 0 && vy != 0 )
move ( vx, vy );
if ( vwidth != 0 && vheight != 0 )
resize ( vwidth, vheight );
openedKeys.clear ( );
KeySet *opened = ksNew ( );
kdbGetChildKeys ( guiKeyPrefix + "openedKeys", opened, KDB_O_RECURSIVE );
for ( size_t i = 0; i < ksGetSize ( opened ); i++)
{
kdbGetValueByParent ( guiKeyPrefix + "openedKeys", QString ( ).setNum ( i ), buf, 300 );
//cout << "pushing back " << buf << endl;
openedKeys.push_back ( buf );
}
ksDel ( opened );
}
示例2: slotRequestVisiblePixmaps
//BEGIN internal SLOTS
void ThumbnailList::slotRequestVisiblePixmaps( int /*newContentsX*/, int newContentsY )
{
// if an update is already scheduled or the widget is hidden, don't proceed
if ( (m_delayTimer && m_delayTimer->isActive()) || !isShown() )
return;
int vHeight = visibleHeight(),
vOffset = newContentsY == -1 ? contentsY() : newContentsY;
// scroll from the top to the last visible thumbnail
m_visibleThumbnails.clear();
QValueList< PixmapRequest * > requestedPixmaps;
QValueVector<ThumbnailWidget *>::iterator tIt = m_thumbnails.begin(), tEnd = m_thumbnails.end();
for ( ; tIt != tEnd; ++tIt )
{
ThumbnailWidget * t = *tIt;
int top = childY( t ) - vOffset;
if ( top > vHeight )
break;
if ( top + t->height() < 0 )
continue;
// add ThumbnailWidget to visible list
m_visibleThumbnails.push_back( t );
// if pixmap not present add it to requests
if ( !t->page()->hasPixmap( THUMBNAILS_ID, t->pixmapWidth(), t->pixmapHeight() ) )
{
PixmapRequest * p = new PixmapRequest(
THUMBNAILS_ID, t->pageNumber(), t->pixmapWidth(), t->pixmapHeight(), THUMBNAILS_PRIO, true );
requestedPixmaps.push_back( p );
}
}
// actually request pixmaps
if ( !requestedPixmaps.isEmpty() )
m_document->requestPixmaps( requestedPixmaps );
}
示例3: lineOfSight
bool Coord_cl::lineOfSight( const Coord_cl &target, UI16 targetheight, bool touch )
{
//Console::instance()->send( QString( "LOScheck: Source:%1,Target:%2,Targetheight:%3\n" ).arg( z ).arg( target.z ).arg( targetheight ) );
if( target.map != map )
return false;
if( (x == target.x) && (y == target.y) && (z == target.z) )
return true; // if source and target are on the same position
SI32 n = ( target.x - x ), m = ( target.y - y ), i = 0;
SI08 sgn_x = ( x <= target.x ) ? 1 : (-1); // signum for x
SI08 sgn_y = ( y <= target.y ) ? 1 : (-1); // signum for y
SI08 sgn_z = ( z <= target.z ) ? 1 : (-1); // signum for z
if( x == target.x )
sgn_x = 0;
if( y == target.y )
sgn_y = 0;
if( z == target.z )
sgn_z = 0;
QValueList< Coord_cl > collisions;
//first we get our x-y-coordinates
if( sgn_x == 0 && sgn_y == 0 && !sgn_z == 0 ) // should fix shooting through floor issues
{
collisions.push_back( Coord_cl( x, y, 0, map ) );
}
else if( sgn_x == 0 ) // if we are on the same x-level, just push every x/y coordinate in y-direction from src to trg into the array
for( i = 0; i <= (sgn_y * m); ++i )
{
collisions.push_back( Coord_cl( x, y + (sgn_y * i), 0, map ) );
}
else if ( sgn_y == 0 ) // if we are on the same y-level, just push every x/y coordinate in x-direction from src to trg into the array
for( i = 0; i <= (sgn_x * n); ++i )
{
collisions.push_back( Coord_cl( x + (sgn_x * i), y, 0, map ) );
}
else
{
SI32 oldpos = y;
bool exaktpos = false;
for( i = 0; (sgn_x * n >= sgn_y * m) && (i <= (sgn_x * n)); i++ )
{
//Console::instance()->send( QString( "x:%1\n" ).arg( i ) );
SI32 gridx = x + (sgn_x * i);
if( ( ( n == 0 ) && ( gridx == 0 ) ) ||
( ( n + ( gridx * m ) == 0 ) ) )
continue;
else
{
if( exaktpos )
{
collisions.push_back( Coord_cl( gridx, oldpos-sgn_y, 0, map ) );
//Console::instance()->send( QString( "add exaktpos coordinate %1,%2\n" ).arg( gridx ).arg( oldpos-sgn_y ) );
exaktpos = false;
}
// linear evaluation of extended 2x2 matrix, abbreviated
double t = (double)sgn_x * ((double)i+0.5) * (double)m / (double)n + (double)y;
//Console::instance()->send( QString( "t:%1\n" ).arg( t ) );
if( ((sgn_y>0) && (specialFloor(t)==oldpos+0.5)) || ((sgn_y<0) && (specialFloor(t)==oldpos-0.5)) )
{
exaktpos = true;
}
if( ((sgn_y>0) && (t<oldpos+0.5)) || ((sgn_y<0) && (t>oldpos-0.5)) || (oldpos==target.y) )
{
collisions.push_back( Coord_cl( gridx, oldpos, 0, map ) );
//Console::instance()->send( QString( "add coordinate %1,%2\n" ).arg( gridx ).arg( oldpos ) );
}
// but if not, we have to take BOTH coordinates, which the calculated collision is between!
else
{
collisions.push_back( Coord_cl( gridx, oldpos, 0, map ) );
//Console::instance()->send( QString( "add coordinate %1,%2\n" ).arg( gridx ).arg( oldpos ) );
oldpos += sgn_y;
collisions.push_back( Coord_cl( gridx, oldpos, 0, map ) );
//Console::instance()->send( QString( "add coordinate %1,%2\n" ).arg( gridx ).arg( oldpos ) );
}
}
}
oldpos = x;
exaktpos = false;
for( i = 0; (sgn_y * m >= sgn_x * n) && (i <= (sgn_y * m)); ++i )
{
//Console::instance()->send( QString( "y:%1\n" ).arg( i ) );
SI32 gridy = y + (sgn_y * i);
if( ( ( m == 0 ) && ( gridy == 0 ) ) ||
( ( m + ( gridy * n ) == 0 ) ) )
continue;
else
{
if( exaktpos )
{
collisions.push_back( Coord_cl( oldpos-sgn_x, gridy, 0, map ) );
//Console::instance()->send( QString( "add exaktpos coordinate %1,%2\n" ).arg( oldpos-sgn_x ).arg( gridy ) );
exaktpos = false;
}
//.........这里部分代码省略.........
示例4: canPlace
//.........这里部分代码省略.........
}
// Moves mobiles inside the multi out to the ban location
MapCharsIterator chars = MapObjects::instance()->listCharsAtCoord( point );
for ( P_CHAR pChar = chars.first(); pChar; pChar = chars.next() )
{
// Move them ALWAYS out, they could be trapped by the castle
// otherwise (or other strange multi forms)
moveOut.append( pChar );
}
// To keep roads house free, here's a specialized check for roads
if ( ( landId >= 0x71 && landId <= 0x8c ) || ( landId >= 0x14c && landId <= 0x14f ) || ( landId >= 0x161 && landId <= 0x174 ) || ( landId >= 0x1f0 && landId <= 0x1f3 ) || ( landId >= 0x26e && landId <= 0x279 ) || ( landId >= 0x27e && landId <= 0x281 ) || ( landId >= 0x324 && landId <= 0x3ac ) || ( landId >= 0x597 && landId <= 0x5a6 ) || ( landId >= 0x637 && landId <= 0x63a ) || ( landId >= 0x67d && landId <= 0x6a0 ) || ( landId >= 0x7ae && landId <= 0x7b1 ) || ( landId >= 0x442 && landId <= 0x479 ) || ( landId >= 0x501 && landId <= 0x510 ) || ( landId >= 0x009 && landId <= 0x015 ) || ( landId >= 0x150 && landId <= 0x15c ) )
{
return false; // Road Blocked
}
// For houses (they have a base you know...)
// we collect another list of points around the house that need to be checked
if ( hasBase )
{
int xOffset, yOffset;
// We have to do two loops since the yard size does play a role here
// but not for the border
for ( xOffset = -1; xOffset <= 1; ++xOffset )
{
for ( yOffset = -yard; yOffset <= yard; ++yOffset )
{
Coord pos = point + Coord( xOffset, yOffset );
if ( !yardList.contains( pos ) )
{
yardList.push_back( pos ); // Put this point into the yard checklist if it's not there
}
}
}
for ( xOffset = -1; xOffset <= 1; ++xOffset )
{
for ( yOffset = -1; yOffset <= 1; ++yOffset )
{
Coord pos = point + Coord( xOffset, yOffset );
// Only do the following if the current tiles position differs from the
// check position.
if ( xOffset != 0 || yOffset != 0 )
{
// The border list should not contain tiles that are actually below the multis
// floor and hence not visible and covered by a walkable multi tile.
// So what we do here is check if within 8 z units of the multis floor there is a
// walkable tile above the border tile
int multiX = x + xOffset; // Offset to the upper left corner of the multi
int multiY = y + yOffset; // Offset to the upper left corner of the multi
bool found = false; // Assume there is no such tile
// Only do this check if the to-be-checked tile is really within the multi
// boundaries
if ( multiX >= 0 && multiY >= 0 && multiX < width && multiY < height )
{
// Get the multi tiles at the to-check position
const QValueVector<multiItem_st> &tiles = multi->itemsAt( multiX + left, multiY + right );
QValueVector<multiItem_st>::const_iterator it;
for ( it = tiles.begin(); it != tiles.end(); ++it )
{
if ( it->z > 8 )