QStringList QCommandLineParser::values(const QString &optionName) const
{
d->checkParsed("values");
- const NameHash_t::const_iterator it = d->nameHash.find(optionName);
+ const NameHash_t::const_iterator it = d->nameHash.constFind(optionName);
if (it != d->nameHash.constEnd()) {
const int optionOffset = *it;
QStringList values = d->optionValuesHash.value(optionOffset);
void QDBusConnectionPrivate::handleSignal(const QString &key, const QDBusMessage& msg)
{
- SignalHookHash::const_iterator it = signalHooks.find(key);
+ SignalHookHash::const_iterator it = signalHooks.constFind(key);
SignalHookHash::const_iterator end = signalHooks.constEnd();
//qDebug("looking for: %s", path.toLocal8Bit().constData());
//qDBusDebug() << signalHooks.keys();
return false; // don't connect
// avoid duplicating:
- QDBusConnectionPrivate::SignalHookHash::ConstIterator it = signalHooks.find(key);
+ QDBusConnectionPrivate::SignalHookHash::ConstIterator it = signalHooks.constFind(key);
QDBusConnectionPrivate::SignalHookHash::ConstIterator end = signalHooks.constEnd();
for ( ; it != end && it.key() == key; ++it) {
const QDBusConnectionPrivate::SignalHook &entry = it.value();
// add it to our list:
QDBusWriteLocker locker(ConnectRelayAction, this);
- SignalHookHash::ConstIterator it = signalHooks.find(key);
+ SignalHookHash::ConstIterator it = signalHooks.constFind(key);
SignalHookHash::ConstIterator end = signalHooks.constEnd();
for ( ; it != end && it.key() == key; ++it) {
const SignalHook &entry = it.value();
bool QtResourceModel::isModified(const QString &path) const
{
- QMap<QString, bool>::const_iterator it = d_ptr->m_pathToModified.find(path);
+ QMap<QString, bool>::const_iterator it = d_ptr->m_pathToModified.constFind(path);
if (it != d_ptr->m_pathToModified.constEnd())
return it.value();
return true;
void QtResourceModel::setModified(const QString &path)
{
- QMap<QString, bool>::const_iterator itMod = d_ptr->m_pathToModified.find(path);
+ QMap<QString, bool>::const_iterator itMod = d_ptr->m_pathToModified.constFind(path);
if (itMod == d_ptr->m_pathToModified.constEnd())
return;
dir = QDir(resource);
QString dirPath = dir.absolutePath();
QMap<QString, QTreeWidgetItem *>::const_iterator it;
- while ((it = d_ptr->m_pathToItem.find(dirPath)) == d_ptr->m_pathToItem.constEnd()) {
+ while ((it = d_ptr->m_pathToItem.constFind(dirPath)) == d_ptr->m_pathToItem.constEnd()) {
if (!dir.cdUp())
break;
dirPath = dir.absolutePath();
QList<QPair<QFileSystemModelPrivate::QFileSystemNode*, int> > values;
QHash<QString, QFileSystemNode *>::const_iterator iterator;
int i = 0;
- for(iterator = indexNode->children.begin() ; iterator != indexNode->children.end() ; ++iterator) {
+ for(iterator = indexNode->children.constBegin() ; iterator != indexNode->children.constEnd() ; ++iterator) {
if (filtersAcceptsNode(iterator.value())) {
values.append(QPair<QFileSystemModelPrivate::QFileSystemNode*, int>((iterator.value()), i));
} else {
// Find the first popup under the mouse (including the popup's descendants) starting from the last.
// Remove all popups after the one found, or all or them if no popup is under the mouse.
// Then continue with the event.
- QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.end();
- while (--iter >= d->popupWidgets.begin() && !wheelCandidates.isEmpty()) {
+ QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.constEnd();
+ while (--iter >= d->popupWidgets.constBegin() && !wheelCandidates.isEmpty()) {
if (wheelCandidates.first() == *iter || (*iter)->isAncestorOf(wheelCandidates.first()))
break;
d->removePopup(*iter);
if (QGraphicsObject *itemobj = item->toGraphicsObject()) {
QGraphicsItemPrivate *d = item->QGraphicsItem::d_func();
QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it =
- d->gestureContext.find(gestureType);
- if (it != d->gestureContext.end() && (!flag || (it.value() & flag))) {
+ d->gestureContext.constFind(gestureType);
+ if (it != d->gestureContext.constEnd() && (!flag || (it.value() & flag))) {
if (normalGestures.contains(gesture)) {
normalGestures.remove(gesture);
if (conflicts)
if (!source_top_left.isValid() || !source_bottom_right.isValid())
return;
QModelIndex source_parent = source_top_left.parent();
- IndexMap::const_iterator it = source_index_mapping.find(source_parent);
+ IndexMap::const_iterator it = source_index_mapping.constFind(source_parent);
if (it == source_index_mapping.constEnd()) {
// Don't care, since we don't have mapping for this index
return;
//clean the QSet that may contains old (and this invalid) indexes
d->hasRemovedItems = false;
QSet<QPersistentModelIndex>::iterator it = d->expandedIndexes.begin();
- while (it != d->expandedIndexes.constEnd()) {
+ while (it != d->expandedIndexes.end()) {
if (!it->isValid())
it = d->expandedIndexes.erase(it);
else
++it;
}
it = d->hiddenIndexes.begin();
- while (it != d->hiddenIndexes.constEnd()) {
+ while (it != d->hiddenIndexes.end()) {
if (!it->isValid())
it = d->hiddenIndexes.erase(it);
else
if (!(wPRmapper && widget->testAttribute(Qt::WA_WState_Reparented)))
return; // not a reparented widget
QWidgetMapper::Iterator it = wPRmapper->begin();
- while (it != wPRmapper->constEnd()) {
+ while (it != wPRmapper->end()) {
QWidget *w = *it;
if (w == etw) { // found widget
etw->setAttribute(Qt::WA_WState_Reparented, false); // clear flag
}
}
- QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.begin();
- while (iter != m_objectGestures.end()) {
+ QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.constBegin();
+ while (iter != m_objectGestures.constEnd()) {
ObjectGesture objectGesture = iter.key();
if (objectGesture.gesture == type) {
foreach (QGesture *g, iter.value()) {
ContextIterator contextEnd = contexts.end();
for (ContextIterator context = contexts.begin(); context != contextEnd; ++context) {
Qt::GestureType gestureType = context.value();
+ const QMap<Qt::GestureType, QGestureRecognizer *> &const_recognizers = m_recognizers;
QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator
- typeToRecognizerIterator = m_recognizers.lowerBound(gestureType),
- typeToRecognizerEnd = m_recognizers.upperBound(gestureType);
+ typeToRecognizerIterator = const_recognizers.lowerBound(gestureType),
+ typeToRecognizerEnd = const_recognizers.upperBound(gestureType);
for (; typeToRecognizerIterator != typeToRecognizerEnd; ++typeToRecognizerIterator) {
QGestureRecognizer *recognizer = typeToRecognizerIterator.value();
QObject *target = context.key();
QWidget *w = receiver;
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
if (!w->d_func()->gestureContext.isEmpty()) {
- for(ContextIterator it = w->d_func()->gestureContext.begin(),
- e = w->d_func()->gestureContext.end(); it != e; ++it) {
+ for(ContextIterator it = w->d_func()->gestureContext.constBegin(),
+ e = w->d_func()->gestureContext.constEnd(); it != e; ++it) {
types.insert(it.key(), 0);
contexts.insertMulti(w, it.key());
}
w = w->isWindow() ? 0 : w->parentWidget();
while (w)
{
- for (ContextIterator it = w->d_func()->gestureContext.begin(),
- e = w->d_func()->gestureContext.end(); it != e; ++it) {
+ for (ContextIterator it = w->d_func()->gestureContext.constBegin(),
+ e = w->d_func()->gestureContext.constEnd(); it != e; ++it) {
if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
types.insert(it.key(), 0);
QGraphicsObject *item = receiver;
if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) {
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
- for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
- e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
+ for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),
+ e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) {
types.insert(it.key(), 0);
contexts.insertMulti(item, it.key());
}
while (item)
{
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
- for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
- e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
+ for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(),
+ e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) {
if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
types.insert(it.key(), 0);
QWidget *w = widget->parentWidget();
while (w) {
QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it
- = w->d_func()->gestureContext.find(type);
- if (it != w->d_func()->gestureContext.end()) {
+ = w->d_func()->gestureContext.constFind(type);
+ if (it != w->d_func()->gestureContext.constEnd()) {
// i.e. 'w' listens to gesture 'type'
if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) {
// conflicting gesture!
<< "\n";
// if there are conflicting gestures, send the GestureOverride event
- for (GesturesPerWidget::const_iterator it = conflictedGestures.begin(),
- e = conflictedGestures.end(); it != e; ++it) {
+ for (GesturesPerWidget::const_iterator it = conflictedGestures.constBegin(),
+ e = conflictedGestures.constEnd(); it != e; ++it) {
QWidget *receiver = it.key();
QList<QGesture *> gestures = it.value();
DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to"
}
// delivering gestures that are not in conflicted state
- for (GesturesPerWidget::const_iterator it = normalStartedGestures.begin(),
- e = normalStartedGestures.end(); it != e; ++it) {
+ for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),
+ e = normalStartedGestures.constEnd(); it != e; ++it) {
if (!it.value().isEmpty()) {
DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key()
<< "gestures:" << it.value();
return layoutData->string;
}
-namespace {
-struct QScriptItemComparator {
- bool operator()(const QScriptItem &a, const QScriptItem &b) { return a.position < b.position; }
- bool operator()(int p, const QScriptItem &b) { return p < b.position; }
- //bool operator()(const QScriptItem &a, int p) { return a.position < p; }
-};
-}
-
void QTextEngine::setBoundary(int strPos) const
{
- if (strPos <= 0 || strPos >= layoutData->string.length())
+ const int item = findItem(strPos);
+ if (item < 0)
return;
- const QScriptItem* it = qUpperBound(layoutData->items.constBegin(), layoutData->items.constEnd(),
- strPos, QScriptItemComparator());
- Q_ASSERT(it > layoutData->items.constBegin());
- --it;
- if (it->position == strPos) {
- // already a split at the requested position
- return;
+ QScriptItem newItem = layoutData->items.at(item);
+ if (newItem.position != strPos) {
+ newItem.position = strPos;
+ layoutData->items.insert(item + 1, newItem);
}
- splitItem(it - layoutData->items.constBegin(), strPos - it->position);
-}
-
-void QTextEngine::splitItem(int item, int pos) const
-{
- if (pos <= 0)
- return;
-
- layoutData->items.insert(item + 1, layoutData->items[item]);
- QScriptItem &oldItem = layoutData->items[item];
- QScriptItem &newItem = layoutData->items[item+1];
- newItem.position += pos;
-
- if (oldItem.num_glyphs) {
- // already shaped, break glyphs aswell
- int breakGlyph = logClusters(&oldItem)[pos];
-
- newItem.num_glyphs = oldItem.num_glyphs - breakGlyph;
- oldItem.num_glyphs = breakGlyph;
- newItem.glyph_data_offset = oldItem.glyph_data_offset + breakGlyph;
-
- for (int i = 0; i < newItem.num_glyphs; i++)
- logClusters(&newItem)[i] -= breakGlyph;
-
- QFixed w = 0;
- const QGlyphLayout g = shapedGlyphs(&oldItem);
- for(int j = 0; j < breakGlyph; ++j)
- w += g.advances_x[j] * !g.attributes[j].dontPrint;
-
- newItem.width = oldItem.width - w;
- oldItem.width = w;
- }
-
-// qDebug("split at position %d itempos=%d", pos, item);
}
QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
#if defined(Q_WS_MAC)
void shapeTextMac(int item) const;
#endif
- void splitItem(int item, int pos) const;
void resolveAdditionalFormats() const;
int endOfLine(int lineNum);
int QTextFormatCollection::indexForFormat(const QTextFormat &format)
{
uint hash = getHash(format.d, format.format_type);
- QMultiHash<uint, int>::const_iterator i = hashes.find(hash);
- while (i != hashes.end() && i.key() == hash) {
+ QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash);
+ while (i != hashes.constEnd() && i.key() == hash) {
if (formats.value(i.value()) == format) {
return i.value();
}
if (fName.startsWith(QLatin1String("./")))
fName = fName.mid(2);
- QMap<QString, int>::ConstIterator it = d->fileMap.find(fName);
- if (it != d->fileMap.end())
+ QMap<QString, int>::ConstIterator it = d->fileMap.constFind(fName);
+ if (it != d->fileMap.constEnd())
fileId = it.value();
else
fileId = 1;
const QString &path = dir.canonicalPath();
// QDir::entryList() is expensive, so we cache the results.
- QMap<QString, QStringList>::ConstIterator it = dirEntriesCache.find(path);
+ QMap<QString, QStringList>::ConstIterator it = dirEntriesCache.constFind(path);
const QStringList &entries = it != dirEntriesCache.constEnd() ?
it.value() : dir.entryList(QDir::Files);
if (it == dirEntriesCache.constEnd())
void Reader::filterFilesForAttributes(const QStringList &attributes)
{
searchIndexTable.clear();
- for(IndexTable::ConstIterator it = indexTable.begin(); it != indexTable.end(); ++it) {
+ for(IndexTable::ConstIterator it = indexTable.constBegin(); it != indexTable.constEnd(); ++it) {
const QString fileName = it.key();
bool containsAll = true;
QStringList split = fileName.split(QLatin1String("@"));
foreach (const QString &term, terms) {
QVector<Document> documents;
- for(IndexTable::ConstIterator it = searchIndexTable.begin();
- it != searchIndexTable.end(); ++it) {
+ for(IndexTable::ConstIterator it = searchIndexTable.constBegin();
+ it != searchIndexTable.constEnd(); ++it) {
EntryTable entryTable = it.value().first;
DocumentList documentList = it.value().second;
return false;
for(QHash<QString, PosEntry*>::ConstIterator mit =
- miniIndex.begin(); mit != miniIndex.end(); ++mit) {
+ miniIndex.constBegin(); mit != miniIndex.constEnd(); ++mit) {
delete mit.value();
}
miniIndex.clear();
void Reader::cleanupIndex(EntryTable &entryTable)
{
for(EntryTable::ConstIterator it =
- entryTable.begin(); it != entryTable.end(); ++it) {
+ entryTable.constBegin(); it != entryTable.constEnd(); ++it) {
delete it.value();
}
void Writer::reset()
{
for(QHash<QString, Entry*>::ConstIterator it =
- index.begin(); it != index.end(); ++it) {
+ index.constBegin(); it != index.constEnd(); ++it) {
delete it.value();
}