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


C++ QPtrList::begin方法代码示例

本文整理汇总了C++中QPtrList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ QPtrList::begin方法的具体用法?C++ QPtrList::begin怎么用?C++ QPtrList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPtrList的用法示例。


在下文中一共展示了QPtrList::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: slotMovedItems

void DOMTreeView::slotMovedItems(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &/*afterFirst*/, QPtrList<QListViewItem> &afterNow)
{
  MultiCommand *cmd = new MultiCommand(i18n("Move Nodes"));
  _refreshed = false;

  QPtrList<QListViewItem>::Iterator it = items.begin();
  QPtrList<QListViewItem>::Iterator anit = afterNow.begin();
  for (; it != items.end(); ++it, ++anit) {
    DOMListViewItem *item = static_cast<DOMListViewItem *>(*it);
    DOMListViewItem *anitem = static_cast<DOMListViewItem *>(*anit);
    DOM::Node parent = static_cast<DOMListViewItem *>(item->parent())->node();
    Q_ASSERT(!parent.isNull());

// kdDebug(90180) << " afternow " << anitem << " node " << (anitem ? anitem->node().nodeName().string() : QString()) << "=" << (anitem ? anitem->node().nodeValue().string() : QString()) << endl;

    cmd->addCommand(new MoveNodeCommand(item->node(), parent,
      anitem ? anitem->node().nextSibling() : parent.firstChild())
    );
  }

  mainWindow()->executeAndAddCommand(cmd);

  // refresh *anyways*, otherwise consistency is disturbed
  if (!_refreshed) refresh();

  slotShowNode(current_node);
}
开发者ID:iegor,项目名称:kdesktop,代码行数:27,代码来源:domtreeview.cpp

示例2: toMediaURL

KURL::List MediaDirNotify::toMediaURL(const KURL &url)
{
    kdDebug(1219) << "MediaDirNotify::toMediaURL(" << url << ")" << endl;

    KURL::List result;

    const QPtrList<Medium> list = m_mediaList.list();

    QPtrList<Medium>::const_iterator it = list.begin();
    QPtrList<Medium>::const_iterator end = list.end();

    for (; it!=end; ++it)
    {
        const Medium *m = *it;
        KURL base = m->prettyBaseURL();

        if ( base.isParentOf(url) )
        {
            QString path = KURL::relativePath(base.path(),
                                              url.path());

            KURL new_url("media:/"+m->name()+"/"+path );
            new_url.cleanPath();

            result.append(new_url);
        }
    }

    kdDebug(1219) << result << endl;
    return result;
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例3: properties

QStringList MediaManager::properties(const QString &name)
{
    const Medium *m = m_mediaList.findByName(name);

    if(!m)
    {
        KURL u(name);
        kdDebug() << "Media::prop " << name << " " << u.isValid() << endl;
        if(u.isValid())
        {
            if(u.protocol() == "system")
            {
                QString path = u.path();
                if(path.startsWith("/media/"))
                    path = path.mid(strlen("/media/"));
                m = m_mediaList.findByName(path);
                kdDebug() << "findByName " << path << m << endl;
            }
            else if(u.protocol() == "media")
            {
                m = m_mediaList.findByName(u.filename());
                kdDebug() << "findByName " << u.filename() << m << endl;
            }
            else if(u.protocol() == "file")
            {
                // look for the mount point
                QPtrList< Medium > list = m_mediaList.list();
                QPtrList< Medium >::const_iterator it = list.begin();
                QPtrList< Medium >::const_iterator end = list.end();
                QString path;

                for(; it != end; ++it)
                {
                    path = KStandardDirs::realFilePath(u.path());
                    kdDebug() << "comparing " << (*it)->mountPoint() << " " << path << " " << (*it)->deviceNode() << endl;
                    if((*it)->mountPoint() == path || (*it)->deviceNode() == path)
                    {
                        m = *it;
                        break;
                    }
                }
            }
        }
    }

    if(m)
        return m->properties();
    else
        return QStringList();
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:50,代码来源:mediamanager.cpp

示例4: fullList

QStringList MediaManager::fullList()
{
    QPtrList< Medium > list = m_mediaList.list();

    QStringList result;

    QPtrList< Medium >::const_iterator it = list.begin();
    QPtrList< Medium >::const_iterator end = list.end();
    for(; it != end; ++it)
    {
        result += (*it)->properties();
        result += Medium::SEPARATOR;
    }

    return result;
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:16,代码来源:mediamanager.cpp

示例5: nameForLabel

QString MediaManager::nameForLabel(const QString &label)
{
    const QPtrList< Medium > media = m_mediaList.list();

    QPtrList< Medium >::const_iterator it = media.begin();
    QPtrList< Medium >::const_iterator end = media.end();
    for(; it != end; ++it)
    {
        const Medium *m = *it;

        if(m->prettyLabel() == label)
        {
            return m->name();
        }
    }

    return QString::null;
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:18,代码来源:mediamanager.cpp


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