本文整理汇总了C++中ItemList::constBegin方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemList::constBegin方法的具体用法?C++ ItemList::constBegin怎么用?C++ ItemList::constBegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::constBegin方法的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 );
}
示例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 ) );
}
}
示例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 );
}
示例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.";
}