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


C++ ItemList::constEnd方法代码示例

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


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

示例1: removeIncidence

void TimelineItem::removeIncidence( KCal::Incidence *incidence )
{
  typedef QList<TimelineSubItem*> ItemList;
  ItemList list = mItemMap[incidence];
  for ( ItemList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it ) {
    delete *it;
  }
  mItemMap.remove( incidence );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:9,代码来源:timelineitem.cpp

示例2: moveItems

void TimelineItem::moveItems( KCal::Incidence *incidence, int delta, int duration )
{
  typedef QList<TimelineSubItem*> ItemList;
  ItemList list = mItemMap[incidence];
  for ( ItemList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it ) {
    QDateTime start = (*it)->originalStart().dateTime();
    start = start.addSecs( delta );
    (*it)->setStartTime( start );
    (*it)->setOriginalStart( KDateTime(start) );
    (*it)->setEndTime( start.addSecs( duration ) );
  }
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:12,代码来源:timelineitem.cpp

示例3: insertIncidence

void TimelineItem::insertIncidence( KCal::Incidence *incidence,
                                    const KDateTime & _start, const KDateTime & _end )
{
  KDateTime start = incidence->dtStart().toTimeSpec( KOPrefs::instance()->timeSpec() );
  KDateTime end = incidence->dtEnd().toTimeSpec( KOPrefs::instance()->timeSpec() );

  if ( _start.isValid() ) {
    start = _start;
  }
  if ( _end.isValid() ) {
    end = _end;
  }
  if ( incidence->allDay() ) {
    end = end.addDays( 1 );
  }

  typedef QList<TimelineSubItem*> ItemList;
  ItemList list = mItemMap[incidence];
  for ( ItemList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it ) {
    if ( KDateTime( (*it)->startTime() ) == start &&
         KDateTime( (*it)->endTime() ) == end ) {
      return;
    }
  }

  TimelineSubItem * item = new TimelineSubItem( mCalendar, incidence, this );
  QColor c1, c2, c3;
  colors( c1, c2, c3 );
  item->setColors( c1, c2, c3 );

  item->setStartTime( start.dateTime() );
  item->setOriginalStart( start );
  item->setEndTime( end.dateTime() );

  mItemMap[incidence].append( item );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:36,代码来源:timelineitem.cpp

示例4: loadPlugins

void WidgetDataBase::loadPlugins()
{
    typedef QMap<QString, int> NameIndexMap;
    typedef QList<QDesignerWidgetDataBaseItemInterface*> ItemList;
    typedef QMap<QString, QDesignerWidgetDataBaseItemInterface*> NameItemMap;
    typedef QSet<QString> NameSet;
    // 1) create a map of existing custom classes
    NameIndexMap existingCustomClasses;
    NameSet nonCustomClasses;
    const int count = m_items.size();
    for (int i = 0; i < count; i++)    {
        const QDesignerWidgetDataBaseItemInterface* item =  m_items[i];
        if (item->isCustom() && !item->isPromoted())
            existingCustomClasses.insert(item->name(), i);
        else
            nonCustomClasses.insert(item->name());
    }
    // 2) create a list plugins
    ItemList pluginList;
    const QDesignerPluginManager *pm = m_core->pluginManager();
    foreach(QDesignerCustomWidgetInterface* c, pm->registeredCustomWidgets())
        pluginList += createCustomWidgetItem(c, pm->customWidgetData(c));

    // 3) replace custom classes or add new ones, remove them from existingCustomClasses,
    // leaving behind deleted items
    unsigned replacedPlugins = 0;
    unsigned addedPlugins = 0;
    unsigned removedPlugins = 0;
    if (!pluginList.empty()) {
        ItemList::const_iterator cend = pluginList.constEnd();
        for (ItemList::const_iterator it = pluginList.constBegin();it != cend; ++it )  {
            QDesignerWidgetDataBaseItemInterface* pluginItem = *it;
            const QString pluginName = pluginItem->name();
            NameIndexMap::iterator existingIt = existingCustomClasses.find(pluginName);
            if (existingIt == existingCustomClasses.end()) {
                // Add new class.
                if (nonCustomClasses.contains(pluginName)) {
                    designerWarning(tr("A custom widget plugin whose class name (%1) matches that of an existing class has been found.").arg(pluginName));
                } else {
                    append(pluginItem);
                    addedPlugins++;
                }
            } else {
                // replace existing info
                const int existingIndex = existingIt.value();
                delete m_items[existingIndex];
                m_items[existingIndex] = pluginItem;
                existingCustomClasses.erase(existingIt);
                replacedPlugins++;

            }
        }
    }
    // 4) remove classes that have not been matched. The stored indexes become invalid while deleting.
    if (!existingCustomClasses.empty()) {
        NameIndexMap::const_iterator cend = existingCustomClasses.constEnd();
        for (NameIndexMap::const_iterator it = existingCustomClasses.constBegin();it != cend; ++it )  {
            const int index = indexOfClassName(it.key());
            if (index != -1) {
                remove(index);
                removedPlugins++;
            }
        }
    }
    if (debugWidgetDataBase)
        qDebug() << "WidgetDataBase::loadPlugins(): " << addedPlugins << " added, " << replacedPlugins << " replaced, " << removedPlugins << "deleted.";
}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:67,代码来源:widgetdatabase.cpp


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