当前位置: 首页>>代码示例>>C++>>正文


C++ QLinkedList::push_front方法代码示例

本文整理汇总了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;
}
开发者ID:xsery,项目名称:benchmarks-esbmc-qt,代码行数:18,代码来源:main.cpp

示例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; 
}
开发者ID:Saljack,项目名称:osp-okular,代码行数:44,代码来源:generator_dvi.cpp


注:本文中的QLinkedList::push_front方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。