本文整理汇总了C++中QMultiMap::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ QMultiMap::remove方法的具体用法?C++ QMultiMap::remove怎么用?C++ QMultiMap::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMultiMap
的用法示例。
在下文中一共展示了QMultiMap::remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cleanResultList
void QgsSnapper::cleanResultList( QMultiMap<double, QgsSnappingResult>& list, const QList<QgsPoint>& excludeList ) const
{
QgsPoint currentResultPoint;
QgsSnappingResult currentSnappingResult;
QList<double> keysToRemove;
QMultiMap<double, QgsSnappingResult>::iterator result_it = list.begin();
for ( ; result_it != list.end(); ++result_it )
{
currentSnappingResult = result_it.value();
if ( currentSnappingResult.snappedVertexNr != -1 )
{
currentResultPoint = currentSnappingResult.snappedVertex;
if ( excludeList.contains( currentResultPoint ) )
{
keysToRemove.push_back( result_it.key() );
}
}
}
QList<double>::const_iterator remove_it = keysToRemove.constBegin();
for ( ; remove_it != keysToRemove.constEnd(); ++remove_it )
{
list.remove( *remove_it );
}
}
示例2: rebuildRows
void ChatSearchFromController::rebuildRows() {
auto ms = getms();
auto wasEmpty = !delegate()->peerListFullRowsCount();
auto now = unixtime();
QMultiMap<int32, UserData*> ordered;
if (_chat->noParticipantInfo()) {
AuthSession::Current().api().requestFullPeer(_chat);
} else if (!_chat->participants.isEmpty()) {
for (auto i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) {
auto user = i.key();
ordered.insertMulti(App::onlineForSort(user, now), user);
}
}
for_const (auto user, _chat->lastAuthors) {
if (user->isInaccessible()) continue;
appendRow(user);
if (!ordered.isEmpty()) {
ordered.remove(App::onlineForSort(user, now), user);
}
}
if (!ordered.isEmpty()) {
for (auto i = ordered.cend(), b = ordered.cbegin(); i != b;) {
appendRow(*(--i));
}
}
checkForEmptyRows();
delegate()->peerListRefreshRows();
}
示例3: toNativeSeparators
// +-----------------------------------------------------------
QString ft::Utils::shortenPath(const QString &sPath, int iMaxLen)
{
// If the string is not long enough, simply return it
if(sPath.length() <= iMaxLen)
return QDir::toNativeSeparators(sPath);
QFileInfo oFile = QFileInfo(sPath);
QString sPathOnly = oFile.path();
QString sFileName = QDir::separator() + oFile.fileName();
QString sDriveLetter = ""; // In case it is running on a Windows OS
// Firstly, split the path (only) into parts (for the drive letter and/or each subfolder)
QRegExp oRegex("([\\\\\\/][\\w -\\.]*)");
QStringList lsParts;
QMultiMap<int, int> mpSortedParts;
QString sPart;
bool bFirst = true;
int iPos = 0;
while((iPos = oRegex.indexIn(sPathOnly, iPos)) != -1)
{
if(bFirst)
{
sDriveLetter = sPathOnly.left(iPos);
bFirst = false;
}
sPart = oRegex.cap(1);
lsParts.push_back(sPart);
mpSortedParts.insert(sPart.length(), lsParts.count() - 1);
iPos += oRegex.matchedLength();
}
// Then, iteratively remove the larger parts while the path is bigger than
// the maximum number of characters desired
QString sNewPath;
do
{
sNewPath = "";
// Rebuild the path replacing the so far larger part for "..."
QMapIterator<int, int> oSorted(mpSortedParts);
oSorted.toBack();
if(oSorted.hasPrevious())
{
int iLength = oSorted.peekPrevious().key();
int iIndex = oSorted.peekPrevious().value();
mpSortedParts.remove(iLength, iIndex);
lsParts.replace(iIndex, QDir::separator() + QString("..."));
for(QStringList::iterator it = lsParts.begin(); it != lsParts.end(); ++it)
sNewPath += *it;
}
} while(sNewPath.length() > 0 && QString(sDriveLetter + sNewPath + sFileName).length() > iMaxLen);
if(sNewPath.length() == 0)
sNewPath = QDir::separator() + QString("...");
return QDir::toNativeSeparators(sDriveLetter + sNewPath + sFileName);
}