本文整理汇总了C++中QLinkedList::push_front方法的典型用法代码示例。如果您正苦于以下问题:C++ QLinkedList::push_front方法的具体用法?C++ QLinkedList::push_front怎么用?C++ QLinkedList::push_front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLinkedList
的用法示例。
在下文中一共展示了QLinkedList::push_front方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
QLinkedList<int> myQLinkedList; // two ints with a value of 100
myQLinkedList.push_back(100);
myQLinkedList.push_back(100);
assert(myQLinkedList.front() == 100);
myQLinkedList.push_front (200);
assert(myQLinkedList.front() == 200);
myQLinkedList.push_front (300);
assert(myQLinkedList.front() == 300);
cout << "myQLinkedList contains:";
for (QLinkedList<int>::iterator it=myQLinkedList.begin(); it!=myQLinkedList.end(); ++it)
cout << " " << *it;
cout << endl;
return 0;
}
示例2: foreach
QLinkedList<Okular::ObjectRect*> DviGenerator::generateDviLinks( const dviPageInfo *pageInfo )
{
QLinkedList<Okular::ObjectRect*> dviLinks;
int pageWidth = pageInfo->width, pageHeight = pageInfo->height;
foreach( const Hyperlink &dviLink, pageInfo->hyperLinkList )
{
QRect boxArea = dviLink.box;
double nl = (double)boxArea.left() / pageWidth,
nt = (double)boxArea.top() / pageHeight,
nr = (double)boxArea.right() / pageWidth,
nb = (double)boxArea.bottom() / pageHeight;
QString linkText = dviLink.linkText;
if ( linkText.startsWith("#") )
linkText = linkText.mid( 1 );
Anchor anch = m_dviRenderer->findAnchor( linkText );
Okular::Action *okuLink = 0;
/* distinguish between local (-> anchor) and remote links */
if (anch.isValid())
{
/* internal link */
Okular::DocumentViewport vp;
fillViewportFromAnchor( vp, anch, pageWidth, pageHeight );
okuLink = new Okular::GotoAction( "", vp );
}
else
{
okuLink = new Okular::BrowseAction( dviLink.linkText );
}
if ( okuLink )
{
Okular::ObjectRect *orlink = new Okular::ObjectRect( nl, nt, nr, nb,
false, Okular::ObjectRect::Action, okuLink );
dviLinks.push_front( orlink );
}
}
return dviLinks;
}