mirror of
https://invent.kde.org/graphics/okular
synced 2024-06-30 22:54:24 +00:00
s/qAsConst/std::as_const/
We now definitely has std::as_const available and Qt has started nagging about converting to std::as_const. Implementation is the same for both functions, and qAsConst was a stop-gap measure until std::as_const was sufficiently available.
This commit is contained in:
parent
5c0d8c9bdc
commit
792425fc77
|
@ -40,7 +40,7 @@ void GeneratorsTest::testLoadsCorrectly()
|
|||
}
|
||||
int failures = 0;
|
||||
int successful = 0;
|
||||
for (const QString &lib : qAsConst(generatorLibs)) {
|
||||
for (const QString &lib : std::as_const(generatorLibs)) {
|
||||
auto factory = KPluginFactory::loadFactory(KPluginMetaData(lib)).plugin;
|
||||
if (!factory) {
|
||||
qWarning() << "Could not get KPluginFactory for" << lib;
|
||||
|
|
|
@ -313,7 +313,7 @@ void MainShellTest::testShell()
|
|||
QCOMPARE(partDocument(part2)->currentPage(), expectedPage);
|
||||
openUrls << part2->url().url();
|
||||
|
||||
for (const QString &path : qAsConst(paths)) {
|
||||
for (const QString &path : std::as_const(paths)) {
|
||||
QVERIFY(openUrls.contains(QStringLiteral("file://%1").arg(path)));
|
||||
}
|
||||
}
|
||||
|
@ -539,7 +539,7 @@ void MainShellTest::testSessionRestore()
|
|||
QList<Shell *> shells = getShells();
|
||||
QVERIFY(!shells.isEmpty());
|
||||
int numDocs = 0;
|
||||
for (Shell *shell : qAsConst(shells)) {
|
||||
for (Shell *shell : std::as_const(shells)) {
|
||||
QVERIFY(QTest::qWaitForWindowExposed(shell));
|
||||
numDocs += shell->m_tabs.size();
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ void MainShellTest::testSessionRestore()
|
|||
int numWindows = 0;
|
||||
{ // Scope for config so that we can reconstruct from file
|
||||
KConfig config(configFile.fileName(), KConfig::SimpleConfig);
|
||||
for (Shell *shell : qAsConst(shells)) {
|
||||
for (Shell *shell : std::as_const(shells)) {
|
||||
shell->savePropertiesInternal(&config, ++numWindows);
|
||||
// Windows aren't necessarily closed on shutdown, but we'll use
|
||||
// this as a way to trigger the destructor code, which is normally
|
||||
|
@ -594,7 +594,7 @@ void MainShellTest::testSessionRestore()
|
|||
shells = getShells();
|
||||
QVERIFY(!shells.isEmpty());
|
||||
numDocs = 0;
|
||||
for (Shell *shell : qAsConst(shells)) {
|
||||
for (Shell *shell : std::as_const(shells)) {
|
||||
QVERIFY(QTest::qWaitForWindowExposed(shell));
|
||||
numDocs += shell->m_tabs.size();
|
||||
}
|
||||
|
|
|
@ -560,7 +560,7 @@ AnnotationPrivate::~AnnotationPrivate()
|
|||
return;
|
||||
}
|
||||
|
||||
for (const Annotation::Revision &revision : qAsConst(m_revisions)) {
|
||||
for (const Annotation::Revision &revision : std::as_const(m_revisions)) {
|
||||
delete revision.annotation();
|
||||
}
|
||||
}
|
||||
|
@ -875,7 +875,7 @@ void Annotation::store(QDomNode &annNode, QDomDocument &document) const
|
|||
}
|
||||
|
||||
// add all revisions as children of revisions element
|
||||
for (const Revision &revision : qAsConst(d->m_revisions)) {
|
||||
for (const Revision &revision : std::as_const(d->m_revisions)) {
|
||||
// create revision element
|
||||
QDomElement r = document.createElement(QStringLiteral("revision"));
|
||||
annNode.appendChild(r);
|
||||
|
@ -1729,7 +1729,7 @@ double LineAnnotationPrivate::distanceSqr(double x, double y, double xScale, dou
|
|||
|
||||
if (m_lineInnerColor.isValid()) {
|
||||
QPolygonF polygon;
|
||||
for (const NormalizedPoint &p : qAsConst(transformedLinePoints)) {
|
||||
for (const NormalizedPoint &p : std::as_const(transformedLinePoints)) {
|
||||
polygon.append(QPointF(p.x, p.y));
|
||||
}
|
||||
|
||||
|
|
|
@ -727,7 +727,7 @@ KBookmark BookmarkManager::nextBookmark(const DocumentViewport &viewport) const
|
|||
std::sort(bmarks.begin(), bmarks.end(), bookmarkLessThan);
|
||||
|
||||
KBookmark bookmark;
|
||||
for (const KBookmark &bm : qAsConst(bmarks)) {
|
||||
for (const KBookmark &bm : std::as_const(bmarks)) {
|
||||
DocumentViewport vp(bm.url().fragment(QUrl::FullyDecoded));
|
||||
if (viewport < vp) {
|
||||
bookmark = bm;
|
||||
|
|
|
@ -353,7 +353,7 @@ void DocumentPrivate::cleanupPixmapMemory(qulonglong memoryToFree)
|
|||
std::list<AllocatedPixmap *> pixmapsToKeep;
|
||||
while (memoryToFree > 0) {
|
||||
int clean_hits = 0;
|
||||
for (DocumentObserver *observer : qAsConst(m_observers)) {
|
||||
for (DocumentObserver *observer : std::as_const(m_observers)) {
|
||||
AllocatedPixmap *p = searchLowestPriorityPixmap(false, true, observer);
|
||||
if (!p) { // No pixmap to remove
|
||||
continue;
|
||||
|
@ -679,7 +679,7 @@ bool DocumentPrivate::loadDocumentInfo(QFile &infoFile, LoadDocumentInfoFlags lo
|
|||
QDomElement viewElement = viewNode.toElement();
|
||||
if (viewElement.tagName() == QLatin1String("view")) {
|
||||
const QString viewName = viewElement.attribute(QStringLiteral("name"));
|
||||
for (View *view : qAsConst(m_views)) {
|
||||
for (View *view : std::as_const(m_views)) {
|
||||
if (view->name() == viewName) {
|
||||
loadViewsInfo(view, viewElement);
|
||||
loadedAnything = true;
|
||||
|
@ -1304,7 +1304,7 @@ void DocumentPrivate::saveDocumentInfo() const
|
|||
// create views root node
|
||||
QDomElement viewsNode = doc.createElement(QStringLiteral("views"));
|
||||
generalInfo.appendChild(viewsNode);
|
||||
for (View *view : qAsConst(m_views)) {
|
||||
for (View *view : std::as_const(m_views)) {
|
||||
QDomElement viewEntry = doc.createElement(QStringLiteral("view"));
|
||||
viewEntry.setAttribute(QStringLiteral("name"), view->name());
|
||||
viewsNode.appendChild(viewEntry);
|
||||
|
@ -1523,7 +1523,7 @@ void DocumentPrivate::rotationFinished(int page, Okular::Page *okularPage)
|
|||
return;
|
||||
}
|
||||
|
||||
for (DocumentObserver *o : qAsConst(m_observers)) {
|
||||
for (DocumentObserver *o : std::as_const(m_observers)) {
|
||||
o->notifyPageChanged(page, DocumentObserver::Pixmap | DocumentObserver::Annotations);
|
||||
}
|
||||
}
|
||||
|
@ -1607,13 +1607,13 @@ void DocumentPrivate::refreshPixmaps(int pageNumber)
|
|||
|
||||
// Need to do this ↑↓ in two steps since requestPixmaps can end up calling cancelRenderingBecauseOf
|
||||
// which changes m_pixmaps and thus breaks the loop above
|
||||
for (PixmapRequest *pr : qAsConst(pixmapsToRequest)) {
|
||||
for (PixmapRequest *pr : std::as_const(pixmapsToRequest)) {
|
||||
QList<Okular::PixmapRequest *> requestedPixmaps;
|
||||
requestedPixmaps.push_back(pr);
|
||||
m_parent->requestPixmaps(requestedPixmaps, Okular::Document::NoOption);
|
||||
}
|
||||
|
||||
for (DocumentObserver *observer : qAsConst(m_observers)) {
|
||||
for (DocumentObserver *observer : std::as_const(m_observers)) {
|
||||
QList<Okular::PixmapRequest *> requestedPixmaps;
|
||||
|
||||
TilesManager *tilesManager = page->d->tilesManager(observer);
|
||||
|
@ -1760,8 +1760,8 @@ void DocumentPrivate::doProcessSearchMatch(RegularAreaRect *match, RunningSearch
|
|||
}
|
||||
|
||||
// notify observers about highlights changes
|
||||
for (int pageNumber : qAsConst(*pagesToNotify)) {
|
||||
for (DocumentObserver *observer : qAsConst(m_observers)) {
|
||||
for (int pageNumber : std::as_const(*pagesToNotify)) {
|
||||
for (DocumentObserver *observer : std::as_const(m_observers)) {
|
||||
observer->notifyPageChanged(pageNumber, DocumentObserver::Highlights);
|
||||
}
|
||||
}
|
||||
|
@ -1791,7 +1791,7 @@ void DocumentPrivate::doContinueAllDocumentSearch(void *pagesToNotifySet, void *
|
|||
}
|
||||
|
||||
Q_EMIT m_parent->searchFinished(searchID, Document::SearchCancelled);
|
||||
for (const MatchesVector &mv : qAsConst(*pageMatches)) {
|
||||
for (const MatchesVector &mv : std::as_const(*pageMatches)) {
|
||||
qDeleteAll(mv);
|
||||
}
|
||||
delete pageMatches;
|
||||
|
@ -1846,13 +1846,13 @@ void DocumentPrivate::doContinueAllDocumentSearch(void *pagesToNotifySet, void *
|
|||
pagesToNotify->insert(it.key()->number());
|
||||
}
|
||||
|
||||
for (DocumentObserver *observer : qAsConst(m_observers)) {
|
||||
for (DocumentObserver *observer : std::as_const(m_observers)) {
|
||||
observer->notifySetup(m_pagesVector, 0);
|
||||
}
|
||||
|
||||
// notify observers about highlights changes
|
||||
for (int pageNumber : qAsConst(*pagesToNotify)) {
|
||||
for (DocumentObserver *observer : qAsConst(m_observers)) {
|
||||
for (int pageNumber : std::as_const(*pagesToNotify)) {
|
||||
for (DocumentObserver *observer : std::as_const(m_observers)) {
|
||||
observer->notifyPageChanged(pageNumber, DocumentObserver::Highlights);
|
||||
}
|
||||
}
|
||||
|
@ -1886,7 +1886,7 @@ void DocumentPrivate::doContinueGooglesDocumentSearch(void *pagesToNotifySet, vo
|
|||
|
||||
Q_EMIT m_parent->searchFinished(searchID, Document::SearchCancelled);
|
||||
|
||||
for (const MatchesVector &mv : qAsConst(*pageMatches)) {
|
||||
for (const MatchesVector &mv : std::as_const(*pageMatches)) {
|
||||
for (const MatchColor &mc : mv) {
|
||||
delete mc.first;
|
||||
}
|
||||
|
@ -1972,13 +1972,13 @@ void DocumentPrivate::doContinueGooglesDocumentSearch(void *pagesToNotifySet, vo
|
|||
}
|
||||
|
||||
// send page lists to update observers (since some filter on bookmarks)
|
||||
for (DocumentObserver *observer : qAsConst(m_observers)) {
|
||||
for (DocumentObserver *observer : std::as_const(m_observers)) {
|
||||
observer->notifySetup(m_pagesVector, 0);
|
||||
}
|
||||
|
||||
// notify observers about highlights changes
|
||||
for (int pageNumber : qAsConst(*pagesToNotify)) {
|
||||
for (DocumentObserver *observer : qAsConst(m_observers)) {
|
||||
for (int pageNumber : std::as_const(*pagesToNotify)) {
|
||||
for (DocumentObserver *observer : std::as_const(m_observers)) {
|
||||
observer->notifyPageChanged(pageNumber, DocumentObserver::Highlights);
|
||||
}
|
||||
}
|
||||
|
@ -2152,7 +2152,7 @@ void DocumentPrivate::loadSyncFile(const QString &filePath)
|
|||
}
|
||||
|
||||
QVector<QList<Okular::SourceRefObjectRect *>> refRects(m_pagesVector.size());
|
||||
for (const pdfsyncpoint &pt : qAsConst(points)) {
|
||||
for (const pdfsyncpoint &pt : std::as_const(points)) {
|
||||
// drop pdfsync points not completely valid
|
||||
if (pt.page < 0 || pt.page >= m_pagesVector.size()) {
|
||||
continue;
|
||||
|
@ -2189,7 +2189,7 @@ void DocumentPrivate::clearAndWaitForRequests()
|
|||
startEventLoop = !m_executingPixmapRequests.empty();
|
||||
|
||||
if (m_generator->hasFeature(Generator::SupportsCancelling)) {
|
||||
for (PixmapRequest *executingRequest : qAsConst(m_executingPixmapRequests)) {
|
||||
for (PixmapRequest *executingRequest : std::as_const(m_executingPixmapRequests)) {
|
||||
executingRequest->d->mShouldAbortRender = 1;
|
||||
}
|
||||
|
||||
|
@ -2499,7 +2499,7 @@ Document::OpenResult Document::openDocument(const QString &docFile, const QUrl &
|
|||
d->m_pageController = new PageController();
|
||||
connect(d->m_pageController, &PageController::rotationFinished, this, [this](int p, Okular::Page *op) { d->rotationFinished(p, op); });
|
||||
|
||||
for (Page *p : qAsConst(d->m_pagesVector)) {
|
||||
for (Page *p : std::as_const(d->m_pagesVector)) {
|
||||
p->d->m_doc = d;
|
||||
}
|
||||
|
||||
|
@ -2643,7 +2643,7 @@ void Document::closeDocument()
|
|||
// ideally we would just do that in the BackendOpaqueAction destructor
|
||||
// but that's too late in the cleanup process, i.e. the generator has already closed its document
|
||||
// and the document generator is nullptr
|
||||
for (Page *p : qAsConst(d->m_pagesVector)) {
|
||||
for (Page *p : std::as_const(d->m_pagesVector)) {
|
||||
const QList<ObjectRect *> &oRects = p->objectRects();
|
||||
for (ObjectRect *oRect : oRects) {
|
||||
if (oRect->objectType() == ObjectRect::Action) {
|
||||
|
@ -2803,7 +2803,7 @@ void Document::removeObserver(DocumentObserver *pObserver)
|
|||
}
|
||||
}
|
||||
|
||||
for (PixmapRequest *executingRequest : qAsConst(d->m_executingPixmapRequests)) {
|
||||
for (PixmapRequest *executingRequest : std::as_const(d->m_executingPixmapRequests)) {
|
||||
if (executingRequest->observer() == pObserver) {
|
||||
d->cancelRenderingBecauseOf(executingRequest, nullptr);
|
||||
}
|
||||
|
@ -3013,7 +3013,7 @@ void Document::setVisiblePageRects(const QVector<VisiblePageRect *> &visiblePage
|
|||
}
|
||||
d->m_pageRects = visiblePageRects;
|
||||
// notify change to all other (different from id) observers
|
||||
for (DocumentObserver *o : qAsConst(d->m_observers)) {
|
||||
for (DocumentObserver *o : std::as_const(d->m_observers)) {
|
||||
if (o != excludeObserver) {
|
||||
o->notifyVisibleRectsChanged();
|
||||
}
|
||||
|
@ -3394,7 +3394,7 @@ void Document::requestPixmaps(const QList<PixmapRequest *> &requests, PixmapRequ
|
|||
|
||||
// 1.C [CANCEL REQUESTS] cancel those requests that are running and should be cancelled because of the new requests coming in
|
||||
if (d->m_generator->hasFeature(Generator::SupportsCancelling)) {
|
||||
for (PixmapRequest *executingRequest : qAsConst(d->m_executingPixmapRequests)) {
|
||||
for (PixmapRequest *executingRequest : std::as_const(d->m_executingPixmapRequests)) {
|
||||
bool newRequestsContainExecutingRequestPage = false;
|
||||
bool requestCancelled = false;
|
||||
for (PixmapRequest *newRequest : requests) {
|
||||
|
@ -3443,7 +3443,7 @@ void Document::requestPixmaps(const QList<PixmapRequest *> &requests, PixmapRequ
|
|||
// if ( generator->canRequestPixmap() )
|
||||
d->sendGeneratorPixmapRequest();
|
||||
|
||||
for (DocumentObserver *o : qAsConst(observersPixmapCleared)) {
|
||||
for (DocumentObserver *o : std::as_const(observersPixmapCleared)) {
|
||||
o->notifyContentsCleared(Okular::DocumentObserver::Pixmap);
|
||||
}
|
||||
}
|
||||
|
@ -3709,7 +3709,7 @@ void Document::setViewport(const DocumentViewport &viewport, DocumentObserver *e
|
|||
const bool currentPageChanged = (oldPageNumber != currentViewportPage);
|
||||
|
||||
// notify change to all other (different from id) observers
|
||||
for (DocumentObserver *o : qAsConst(d->m_observers)) {
|
||||
for (DocumentObserver *o : std::as_const(d->m_observers)) {
|
||||
if (o != excludeObserver) {
|
||||
o->notifyViewportChanged(smoothMove);
|
||||
}
|
||||
|
@ -3736,7 +3736,7 @@ void Document::setViewportPage(int page, DocumentObserver *excludeObserver, bool
|
|||
void Document::setZoom(int factor, DocumentObserver *excludeObserver)
|
||||
{
|
||||
// notify change to all other (different from id) observers
|
||||
for (DocumentObserver *o : qAsConst(d->m_observers)) {
|
||||
for (DocumentObserver *o : std::as_const(d->m_observers)) {
|
||||
if (o != excludeObserver) {
|
||||
o->notifyZoom(factor);
|
||||
}
|
||||
|
@ -3820,7 +3820,7 @@ void Document::searchText(int searchID, const QString &text, bool fromStart, Qt:
|
|||
|
||||
// remove highlights from pages and queue them for notifying changes
|
||||
*pagesToNotify += s->highlightedPages;
|
||||
for (const int pageNumber : qAsConst(s->highlightedPages)) {
|
||||
for (const int pageNumber : std::as_const(s->highlightedPages)) {
|
||||
d->m_pagesVector.at(pageNumber)->d->deleteHighlights(searchID);
|
||||
}
|
||||
s->highlightedPages.clear();
|
||||
|
@ -3933,7 +3933,7 @@ void Document::resetSearch(int searchID)
|
|||
RunningSearch *s = *searchIt;
|
||||
|
||||
// unhighlight pages and inform observers about that
|
||||
for (const int pageNumber : qAsConst(s->highlightedPages)) {
|
||||
for (const int pageNumber : std::as_const(s->highlightedPages)) {
|
||||
d->m_pagesVector.at(pageNumber)->d->deleteHighlights(searchID);
|
||||
foreachObserver(notifyPageChanged(pageNumber, DocumentObserver::Highlights));
|
||||
}
|
||||
|
@ -4759,7 +4759,7 @@ QStringList Document::supportedMimeTypes() const
|
|||
// Remove duplicate mimetypes represented by different names
|
||||
QMimeDatabase mimeDatabase;
|
||||
QSet<QMimeType> uniqueMimetypes;
|
||||
for (const QString &mimeName : qAsConst(result)) {
|
||||
for (const QString &mimeName : std::as_const(result)) {
|
||||
uniqueMimetypes.insert(mimeDatabase.mimeTypeForName(mimeName));
|
||||
}
|
||||
result.clear();
|
||||
|
|
|
@ -600,7 +600,7 @@ EditFormButtonsCommand::EditFormButtonsCommand(Okular::DocumentPrivate *docPriv,
|
|||
, m_prevButtonStates(QList<bool>())
|
||||
{
|
||||
setText(i18nc("Edit the state of a group of form buttons", "edit form button states"));
|
||||
for (const FormFieldButton *formButton : qAsConst(m_formButtons)) {
|
||||
for (const FormFieldButton *formButton : std::as_const(m_formButtons)) {
|
||||
m_prevButtonStates.append(formButton->state());
|
||||
}
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ bool EditFormButtonsCommand::refreshInternalPageReferences(const QVector<Okular:
|
|||
|
||||
void EditFormButtonsCommand::clearFormButtonStates()
|
||||
{
|
||||
for (FormFieldButton *formButton : qAsConst(m_formButtons)) {
|
||||
for (FormFieldButton *formButton : std::as_const(m_formButtons)) {
|
||||
formButton->setState(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ public:
|
|||
QList<int> choices = q->currentChoices();
|
||||
std::sort(choices.begin(), choices.end());
|
||||
QStringList list;
|
||||
for (const int c : qAsConst(choices)) {
|
||||
for (const int c : std::as_const(choices)) {
|
||||
list.append(QString::number(c));
|
||||
}
|
||||
return list.join(QStringLiteral(";"));
|
||||
|
|
|
@ -428,12 +428,12 @@ void PagePrivate::rotateAt(Rotation orientation)
|
|||
* Rotate the object rects on the page.
|
||||
*/
|
||||
const QTransform matrix = rotationMatrix();
|
||||
for (ObjectRect *objRect : qAsConst(m_page->m_rects)) {
|
||||
for (ObjectRect *objRect : std::as_const(m_page->m_rects)) {
|
||||
objRect->transform(matrix);
|
||||
}
|
||||
|
||||
const QTransform highlightRotationMatrix = Okular::buildRotationMatrix((Rotation)(((int)m_rotation - (int)oldRotation + 4) % 4));
|
||||
for (HighlightAreaRect *hlar : qAsConst(m_page->m_highlights)) {
|
||||
for (HighlightAreaRect *hlar : std::as_const(m_page->m_highlights)) {
|
||||
hlar->transform(highlightRotationMatrix);
|
||||
}
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ void Page::setFormFields(const QList<FormField *> &fields)
|
|||
{
|
||||
qDeleteAll(d->formfields);
|
||||
d->formfields = fields;
|
||||
for (FormField *ff : qAsConst(d->formfields)) {
|
||||
for (FormField *ff : std::as_const(d->formfields)) {
|
||||
ff->d_ptr->setDefault();
|
||||
ff->d_ptr->m_page = this;
|
||||
}
|
||||
|
@ -878,7 +878,7 @@ bool PagePrivate::restoreLocalContents(const QDomNode &pageNode)
|
|||
}
|
||||
|
||||
QHash<int, FormField *> hashedforms;
|
||||
for (FormField *ff : qAsConst(formfields)) {
|
||||
for (FormField *ff : std::as_const(formfields)) {
|
||||
hashedforms[ff->id()] = ff;
|
||||
}
|
||||
|
||||
|
@ -933,7 +933,7 @@ void PagePrivate::saveLocalContents(QDomNode &parentNode, QDomDocument &document
|
|||
QDomElement annotListElement = document.createElement(QStringLiteral("annotationList"));
|
||||
|
||||
// add every annotation to the annotationList
|
||||
for (const Annotation *a : qAsConst(m_page->m_annotations)) {
|
||||
for (const Annotation *a : std::as_const(m_page->m_annotations)) {
|
||||
// only save okular annotations (not the embedded in file ones)
|
||||
if (!(a->flags() & Annotation::External)) {
|
||||
// append an filled-up element called 'annotation' to the list
|
||||
|
@ -1068,26 +1068,26 @@ FormField *PagePrivate::findEquivalentForm(const Page *p, FormField *oldField)
|
|||
{
|
||||
// given how id is not very good of id (at least for pdf) we do a few passes
|
||||
// same rect, type and id
|
||||
for (FormField *f : qAsConst(p->d->formfields)) {
|
||||
for (FormField *f : std::as_const(p->d->formfields)) {
|
||||
if (f->rect() == oldField->rect() && f->type() == oldField->type() && f->id() == oldField->id()) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
// same rect and type
|
||||
for (FormField *f : qAsConst(p->d->formfields)) {
|
||||
for (FormField *f : std::as_const(p->d->formfields)) {
|
||||
if (f->rect() == oldField->rect() && f->type() == oldField->type()) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
// fuzzy rect, same type and id
|
||||
for (FormField *f : qAsConst(p->d->formfields)) {
|
||||
for (FormField *f : std::as_const(p->d->formfields)) {
|
||||
if (f->type() == oldField->type() && f->id() == oldField->id() && qFuzzyCompare(f->rect().left, oldField->rect().left) && qFuzzyCompare(f->rect().top, oldField->rect().top) &&
|
||||
qFuzzyCompare(f->rect().right, oldField->rect().right) && qFuzzyCompare(f->rect().bottom, oldField->rect().bottom)) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
// fuzzy rect and same type
|
||||
for (FormField *f : qAsConst(p->d->formfields)) {
|
||||
for (FormField *f : std::as_const(p->d->formfields)) {
|
||||
if (f->type() == oldField->type() && qFuzzyCompare(f->rect().left, oldField->rect().left) && qFuzzyCompare(f->rect().top, oldField->rect().top) && qFuzzyCompare(f->rect().right, oldField->rect().right) &&
|
||||
qFuzzyCompare(f->rect().bottom, oldField->rect().bottom)) {
|
||||
return f;
|
||||
|
|
|
@ -104,7 +104,7 @@ int JSDocument::numFields() const
|
|||
{
|
||||
unsigned int numFields = 0;
|
||||
|
||||
for (const Page *pIt : qAsConst(m_doc->m_pagesVector)) {
|
||||
for (const Page *pIt : std::as_const(m_doc->m_pagesVector)) {
|
||||
numFields += pIt->formFields().size();
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ void JSDocument::syncAnnotScan() const
|
|||
// Document.getNthFieldName
|
||||
QJSValue JSDocument::getNthFieldName(int nIndex) const
|
||||
{
|
||||
for (const Page *pIt : qAsConst(m_doc->m_pagesVector)) {
|
||||
for (const Page *pIt : std::as_const(m_doc->m_pagesVector)) {
|
||||
const QList<Okular::FormField *> pageFields = pIt->formFields();
|
||||
|
||||
if (nIndex < pageFields.size()) {
|
||||
|
|
|
@ -292,11 +292,11 @@ Document::OpenResult TextDocumentGenerator::loadDocumentWithPassword(const QStri
|
|||
|
||||
// loading failed, cleanup all the stuff eventually gathered from the converter
|
||||
d->mTitlePositions.clear();
|
||||
for (const TextDocumentGeneratorPrivate::LinkPosition &linkPos : qAsConst(d->mLinkPositions)) {
|
||||
for (const TextDocumentGeneratorPrivate::LinkPosition &linkPos : std::as_const(d->mLinkPositions)) {
|
||||
delete linkPos.link;
|
||||
}
|
||||
d->mLinkPositions.clear();
|
||||
for (const TextDocumentGeneratorPrivate::AnnotationPosition &annPos : qAsConst(d->mAnnotationPositions)) {
|
||||
for (const TextDocumentGeneratorPrivate::AnnotationPosition &annPos : std::as_const(d->mAnnotationPositions)) {
|
||||
delete annPos.annotation;
|
||||
}
|
||||
d->mAnnotationPositions.clear();
|
||||
|
@ -562,7 +562,7 @@ void TextDocumentGenerator::setTextDocument(QTextDocument *textDocument)
|
|||
|
||||
d->mDocument = textDocument;
|
||||
|
||||
for (Page *p : qAsConst(d->m_document->m_pagesVector)) {
|
||||
for (Page *p : std::as_const(d->m_document->m_pagesVector)) {
|
||||
p->setTextPage(nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1676,7 +1676,7 @@ WordsWithCharacters addNecessarySpace(RegionTextList tree, int pageWidth, int pa
|
|||
}
|
||||
|
||||
WordsWithCharacters tmpList;
|
||||
for (const QPair<WordsWithCharacters, QRect> &sortedLine : qAsConst(sortedLines)) {
|
||||
for (const QPair<WordsWithCharacters, QRect> &sortedLine : std::as_const(sortedLines)) {
|
||||
tmpList += sortedLine.first;
|
||||
}
|
||||
tmpRegion.setText(tmpList);
|
||||
|
@ -1684,7 +1684,7 @@ WordsWithCharacters addNecessarySpace(RegionTextList tree, int pageWidth, int pa
|
|||
|
||||
// Step 03
|
||||
WordsWithCharacters tmp;
|
||||
for (const RegionText &tmpRegion : qAsConst(tree)) {
|
||||
for (const RegionText &tmpRegion : std::as_const(tree)) {
|
||||
tmp += tmpRegion.text();
|
||||
}
|
||||
return tmp;
|
||||
|
@ -1744,7 +1744,7 @@ TextEntity::List TextPage::words(const RegularAreaRect *area, TextAreaInclusionB
|
|||
|
||||
TextEntity::List ret;
|
||||
if (area) {
|
||||
for (const TinyTextEntity *te : qAsConst(d->m_words)) {
|
||||
for (const TinyTextEntity *te : std::as_const(d->m_words)) {
|
||||
if (b == AnyPixelTextAreaInclusionBehaviour) {
|
||||
if (area->intersects(te->area)) {
|
||||
ret.append(new TextEntity(te->text(), new Okular::NormalizedRect(te->area)));
|
||||
|
@ -1757,7 +1757,7 @@ TextEntity::List TextPage::words(const RegularAreaRect *area, TextAreaInclusionB
|
|||
}
|
||||
}
|
||||
} else {
|
||||
for (const TinyTextEntity *te : qAsConst(d->m_words)) {
|
||||
for (const TinyTextEntity *te : std::as_const(d->m_words)) {
|
||||
ret.append(new TextEntity(te->text(), new Okular::NormalizedRect(te->area)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ void TilesManager::Private::setPixmap(const QPixmap *pixmap, const NormalizedRec
|
|||
bool TilesManager::hasPixmap(const NormalizedRect &rect)
|
||||
{
|
||||
NormalizedRect rotatedRect = fromRotatedRect(rect, d->rotation);
|
||||
for (const TileNode &tile : qAsConst(d->tiles)) {
|
||||
for (const TileNode &tile : std::as_const(d->tiles)) {
|
||||
if (!d->hasPixmap(rotatedRect, tile)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ bool CHMGenerator::loadDocument(const QString &fileName, QVector<Okular::Page *>
|
|||
QMap<QString, int> tmpPageList;
|
||||
int pageNum = 0;
|
||||
|
||||
for (const EBookTocEntry &e : qAsConst(topics)) {
|
||||
for (const EBookTocEntry &e : std::as_const(topics)) {
|
||||
QDomElement item = m_docSyn.createElement(e.name);
|
||||
if (!e.url.isEmpty()) {
|
||||
QString url = e.url.toString();
|
||||
|
@ -100,7 +100,7 @@ bool CHMGenerator::loadDocument(const QString &fileName, QVector<Okular::Page *>
|
|||
}
|
||||
m_pageUrl.resize(pageNum);
|
||||
|
||||
for (const QUrl &qurl : qAsConst(pageList)) {
|
||||
for (const QUrl &qurl : std::as_const(pageList)) {
|
||||
QString url = qurl.toString();
|
||||
const QString urlLower = url.toLower();
|
||||
if (!urlLower.endsWith(QLatin1String(".html")) && !urlLower.endsWith(QLatin1String(".htm"))) {
|
||||
|
|
|
@ -275,7 +275,7 @@ void ProtocolMSITS::listDir(const QUrl &url)
|
|||
UDSEntry entry;
|
||||
int striplength = filepath.length();
|
||||
|
||||
for (const QString &iListing : qAsConst(listing)) {
|
||||
for (const QString &iListing : std::as_const(listing)) {
|
||||
// Strip the directory name
|
||||
const QString ename = iListing.mid(striplength);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ bool EBook_CHM::getTableOfContents(QList<EBookTocEntry> &toc) const
|
|||
|
||||
// Fill up the real toc
|
||||
toc.reserve(parsed.size());
|
||||
for (const ParsedEntry &e : qAsConst(parsed)) {
|
||||
for (const ParsedEntry &e : std::as_const(parsed)) {
|
||||
if (root_offset == -1) {
|
||||
root_offset = e.indent;
|
||||
}
|
||||
|
|
|
@ -220,20 +220,20 @@ bool EBook_EPUB::parseBookinfo()
|
|||
m_title = content_parser.metadata[QStringLiteral("title")];
|
||||
|
||||
// Move the manifest entries into the list
|
||||
for (const QString &f : qAsConst(content_parser.manifest)) {
|
||||
for (const QString &f : std::as_const(content_parser.manifest)) {
|
||||
m_ebookManifest.push_back(pathToUrl(f));
|
||||
}
|
||||
|
||||
// Copy the manifest information and fill up the other maps if we have it
|
||||
if (!toc_parser.entries.isEmpty()) {
|
||||
for (const EBookTocEntry &e : qAsConst(toc_parser.entries)) {
|
||||
for (const EBookTocEntry &e : std::as_const(toc_parser.entries)) {
|
||||
// Add into url-title map
|
||||
m_urlTitleMap[e.url] = e.name;
|
||||
m_tocEntries.push_back(e);
|
||||
}
|
||||
} else {
|
||||
// Copy them from spine
|
||||
for (QString url : qAsConst(content_parser.spine)) {
|
||||
for (QString url : std::as_const(content_parser.spine)) {
|
||||
EBookTocEntry e;
|
||||
|
||||
if (content_parser.manifest.contains(url)) {
|
||||
|
|
|
@ -101,7 +101,7 @@ bool EBookSearch::generateIndex(EBook *ebookFile, QDataStream &stream)
|
|||
connect(m_Index, &QtAs::Index::indexingProgress, this, &EBookSearch::updateProgress);
|
||||
|
||||
// Process the list of files in CHM archive and keep only HTML document files from there
|
||||
for (const QUrl &allDocumentsI : qAsConst(alldocuments)) {
|
||||
for (const QUrl &allDocumentsI : std::as_const(alldocuments)) {
|
||||
const QString docpath = allDocumentsI.path();
|
||||
|
||||
if (docpath.endsWith(QLatin1String(".html"), Qt::CaseInsensitive) || docpath.endsWith(QLatin1String(".htm"), Qt::CaseInsensitive) || docpath.endsWith(QLatin1String(".xhtml"), Qt::CaseInsensitive)) {
|
||||
|
|
|
@ -355,7 +355,7 @@ QList<QUrl> Index::query(const QStringList &terms, const QStringList &termSeq, c
|
|||
std::sort(termList.begin(), termList.end());
|
||||
|
||||
QVector<Document> minDocs = termList.takeFirst().documents;
|
||||
for (const Term &t : qAsConst(termList)) {
|
||||
for (const Term &t : std::as_const(termList)) {
|
||||
const QVector<Document> docs = t.documents;
|
||||
for (QVector<Document>::Iterator minDoc_it = minDocs.begin(); minDoc_it != minDocs.end();) {
|
||||
bool found = false;
|
||||
|
@ -377,14 +377,14 @@ QList<QUrl> Index::query(const QStringList &terms, const QStringList &termSeq, c
|
|||
QList<QUrl> results;
|
||||
std::sort(minDocs.begin(), minDocs.end());
|
||||
if (termSeq.isEmpty()) {
|
||||
for (const Document &doc : qAsConst(minDocs)) {
|
||||
for (const Document &doc : std::as_const(minDocs)) {
|
||||
results << docList.at((int)doc.docNumber);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
QUrl fileName;
|
||||
for (const Document &doc : qAsConst(minDocs)) {
|
||||
for (const Document &doc : std::as_const(minDocs)) {
|
||||
fileName = docList[(int)doc.docNumber];
|
||||
if (searchForPhrases(termSeq, seqWords, fileName, chmFile)) {
|
||||
results << fileName;
|
||||
|
|
|
@ -186,7 +186,7 @@ void Document::pages(QVector<Okular::Page *> *pagesVector)
|
|||
pagesVector->resize(mEntries.size());
|
||||
QImageReader reader;
|
||||
reader.setAutoTransform(true);
|
||||
for (const QString &file : qAsConst(mEntries)) {
|
||||
for (const QString &file : std::as_const(mEntries)) {
|
||||
if (mArchive) {
|
||||
const KArchiveFile *entry = static_cast<const KArchiveFile *>(mArchiveDir->entry(file));
|
||||
if (entry) {
|
||||
|
|
|
@ -162,7 +162,7 @@ QStringList Unrar::list()
|
|||
}
|
||||
|
||||
QStringList newList;
|
||||
for (const QString &f : qAsConst(listFiles)) {
|
||||
for (const QString &f : std::as_const(listFiles)) {
|
||||
// Extract all the files to mTempDir regardless of their path inside the archive
|
||||
// This will break if ever an arvhice with two files with the same name in different subfolders
|
||||
QFileInfo fi(f);
|
||||
|
|
|
@ -144,7 +144,7 @@ QList<Okular::ObjectRect *> DviGenerator::generateDviLinks(const dviPageInfo *pa
|
|||
|
||||
int pageWidth = pageInfo->width, pageHeight = pageInfo->height;
|
||||
|
||||
for (const Hyperlink &dviLink : qAsConst(pageInfo->hyperLinkList)) {
|
||||
for (const Hyperlink &dviLink : std::as_const(pageInfo->hyperLinkList)) {
|
||||
QRect boxArea = dviLink.box;
|
||||
double nl = (double)boxArea.left() / pageWidth, nt = (double)boxArea.top() / pageHeight, nr = (double)boxArea.right() / pageWidth, nb = (double)boxArea.bottom() / pageHeight;
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ QTextDocument *Converter::convert(const QString &fileName)
|
|||
newDoc.setContent(QStringLiteral("<img src=\"%1\" height=\"%2\" width=\"%3\" />").arg(lnk).arg(ht).arg(wd));
|
||||
imgNodes.append(newDoc.documentElement());
|
||||
}
|
||||
for (const QDomNode &nd : qAsConst(imgNodes)) {
|
||||
for (const QDomNode &nd : std::as_const(imgNodes)) {
|
||||
svgs.at(i).parentNode().replaceChild(nd, svgs.at(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -873,7 +873,7 @@ void PDFGenerator::loadPages(QVector<Okular::Page *> &pagesVector, int rotation,
|
|||
auto compareSignatureByFullyQualifiedName = [&fullyQualifiedName](const Okular::FormField *off) { return off->fullyQualifiedName() == fullyQualifiedName; };
|
||||
|
||||
// See if the signature is in one of the already loaded page (i.e. 1 to end)
|
||||
for (Okular::Page *p : qAsConst(pagesVector)) {
|
||||
for (Okular::Page *p : std::as_const(pagesVector)) {
|
||||
const QList<Okular::FormField *> pageFormFields = p->formFields();
|
||||
if (std::find_if(pageFormFields.begin(), pageFormFields.end(), compareSignatureByFullyQualifiedName) != pageFormFields.end()) {
|
||||
createSignature = false;
|
||||
|
@ -1045,7 +1045,7 @@ Okular::FontInfo::List PDFGenerator::fontsForPage(int page)
|
|||
}
|
||||
userMutex()->unlock();
|
||||
|
||||
for (const Poppler::FontInfo &font : qAsConst(fonts)) {
|
||||
for (const Poppler::FontInfo &font : std::as_const(fonts)) {
|
||||
Okular::FontInfo of;
|
||||
of.setName(font.name());
|
||||
of.setSubstituteName(font.substituteName());
|
||||
|
|
|
@ -474,7 +474,7 @@ static QByteArray readFileOrDirectoryParts(const KArchiveEntry *entry, QString *
|
|||
const KArchiveDirectory *relDir = static_cast<const KArchiveDirectory *>(entry);
|
||||
QStringList entries = relDir->entries();
|
||||
std::sort(entries.begin(), entries.end());
|
||||
for (const QString &entry : qAsConst(entries)) {
|
||||
for (const QString &entry : std::as_const(entries)) {
|
||||
const KArchiveEntry *relSubEntry = relDir->entry(entry);
|
||||
if (!relSubEntry->isFile()) {
|
||||
continue;
|
||||
|
@ -520,7 +520,7 @@ static const KArchiveEntry *loadEntry(KZip *archive, const QString &fileName, Qt
|
|||
const KArchiveDirectory *relDir = static_cast<const KArchiveDirectory *>(newEntry);
|
||||
QStringList relEntries = relDir->entries();
|
||||
std::sort(relEntries.begin(), relEntries.end());
|
||||
for (const QString &relEntry : qAsConst(relEntries)) {
|
||||
for (const QString &relEntry : std::as_const(relEntries)) {
|
||||
if (relEntry.compare(entryName, Qt::CaseInsensitive) == 0) {
|
||||
return relDir->entry(relEntry);
|
||||
}
|
||||
|
@ -1027,7 +1027,7 @@ void XpsPage::processPath(QPainter *painter, XpsRenderNode &node)
|
|||
painter->setWorldTransform(pathdata->transform, true);
|
||||
}
|
||||
|
||||
for (const XpsPathFigure *figure : qAsConst(pathdata->paths)) {
|
||||
for (const XpsPathFigure *figure : std::as_const(pathdata->paths)) {
|
||||
painter->setBrush(figure->isFilled ? brush : QBrush());
|
||||
painter->drawPath(figure->path);
|
||||
}
|
||||
|
@ -1050,7 +1050,7 @@ void XpsPage::processPathGeometry(XpsRenderNode &node)
|
|||
{
|
||||
XpsPathGeometry *geom = new XpsPathGeometry();
|
||||
|
||||
for (const XpsRenderNode &child : qAsConst(node.children)) {
|
||||
for (const XpsRenderNode &child : std::as_const(node.children)) {
|
||||
if (child.data.canConvert<XpsPathFigure *>()) {
|
||||
XpsPathFigure *figure = child.data.value<XpsPathFigure *>();
|
||||
geom->paths.append(figure);
|
||||
|
@ -1100,7 +1100,7 @@ void XpsPage::processPathFigure(XpsRenderNode &node)
|
|||
return;
|
||||
}
|
||||
|
||||
for (const XpsRenderNode &child : qAsConst(node.children)) {
|
||||
for (const XpsRenderNode &child : std::as_const(node.children)) {
|
||||
bool isStroked = true;
|
||||
att = node.attributes.value(QStringLiteral("IsStroked")).toString();
|
||||
if (!att.isEmpty()) {
|
||||
|
@ -1251,7 +1251,7 @@ void XpsPage::processEndElement(QPainter *painter, XpsRenderNode &node)
|
|||
}
|
||||
} else if (node.name == QLatin1String("LinearGradientBrush.GradientStops")) {
|
||||
QList<XpsGradient> gradients;
|
||||
for (const XpsRenderNode &child : qAsConst(node.children)) {
|
||||
for (const XpsRenderNode &child : std::as_const(node.children)) {
|
||||
double offset = child.attributes.value(QStringLiteral("Offset")).toDouble();
|
||||
QColor color = hexToRgba(child.attributes.value(QStringLiteral("Color")).toLatin1());
|
||||
gradients.append(XpsGradient(offset, color));
|
||||
|
@ -1264,7 +1264,7 @@ void XpsPage::processEndElement(QPainter *painter, XpsRenderNode &node)
|
|||
}
|
||||
} else if (node.name == QLatin1String("RadialGradientBrush.GradientStops")) {
|
||||
QList<XpsGradient> gradients;
|
||||
for (const XpsRenderNode &child : qAsConst(node.children)) {
|
||||
for (const XpsRenderNode &child : std::as_const(node.children)) {
|
||||
double offset = child.attributes.value(QStringLiteral("Offset")).toDouble();
|
||||
QColor color = hexToRgba(child.attributes.value(QStringLiteral("Color")).toLatin1());
|
||||
gradients.append(XpsGradient(offset, color));
|
||||
|
@ -1779,7 +1779,7 @@ XpsFile::XpsFile()
|
|||
|
||||
XpsFile::~XpsFile()
|
||||
{
|
||||
for (int fontId : qAsConst(m_fontCache)) {
|
||||
for (int fontId : std::as_const(m_fontCache)) {
|
||||
m_fontDatabase.removeApplicationFont(fontId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ void PagePainter::paintCroppedPageOnPainter(QPainter *destPainter,
|
|||
// 4B.3. highlight rects in page
|
||||
if (bufferedHighlights) {
|
||||
// draw highlights that are inside the 'limits' paint region
|
||||
for (const auto &highlight : qAsConst(*bufferedHighlights)) {
|
||||
for (const auto &highlight : std::as_const(*bufferedHighlights)) {
|
||||
const Okular::NormalizedRect &r = highlight.second;
|
||||
// find out the rect to highlight on pixmap
|
||||
QRect highlightRect = r.geometry(scaledWidth, scaledHeight).translated(-scaledCrop.topLeft()).intersected(limits);
|
||||
|
|
|
@ -106,7 +106,7 @@ static void updateFormFieldSignaturePointer(SignatureItem *item, const QVector<O
|
|||
}
|
||||
}
|
||||
|
||||
for (SignatureItem *child : qAsConst(item->children)) {
|
||||
for (SignatureItem *child : std::as_const(item->children)) {
|
||||
updateFormFieldSignaturePointer(child, pages);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ void TOCModel::fill(const Okular::DocumentSynopsis *toc)
|
|||
d->dirty = true;
|
||||
Q_EMIT layoutChanged();
|
||||
if (equals(d->m_oldModel)) {
|
||||
for (const QModelIndex &oldIndex : qAsConst(d->m_oldTocExpandedIndexes)) {
|
||||
for (const QModelIndex &oldIndex : std::as_const(d->m_oldTocExpandedIndexes)) {
|
||||
const QModelIndex index = indexForIndex(oldIndex, this);
|
||||
if (!index.isValid()) {
|
||||
continue;
|
||||
|
@ -350,7 +350,7 @@ void TOCModel::fill(const Okular::DocumentSynopsis *toc)
|
|||
QMetaObject::invokeMethod(QObject::parent(), "expand", Qt::QueuedConnection, Q_ARG(QModelIndex, index));
|
||||
}
|
||||
} else {
|
||||
for (TOCItem *item : qAsConst(d->itemsToOpen)) {
|
||||
for (TOCItem *item : std::as_const(d->itemsToOpen)) {
|
||||
const QModelIndex index = d->indexForItem(item);
|
||||
if (!index.isValid()) {
|
||||
continue;
|
||||
|
@ -382,7 +382,7 @@ void TOCModel::clear()
|
|||
|
||||
void TOCModel::setCurrentViewport(const Okular::DocumentViewport &viewport)
|
||||
{
|
||||
for (TOCItem *item : qAsConst(d->currentPage)) {
|
||||
for (TOCItem *item : std::as_const(d->currentPage)) {
|
||||
QModelIndex index = d->indexForItem(item);
|
||||
if (!index.isValid()) {
|
||||
continue;
|
||||
|
@ -398,7 +398,7 @@ void TOCModel::setCurrentViewport(const Okular::DocumentViewport &viewport)
|
|||
|
||||
d->currentPage = newCurrentPage;
|
||||
|
||||
for (TOCItem *item : qAsConst(d->currentPage)) {
|
||||
for (TOCItem *item : std::as_const(d->currentPage)) {
|
||||
QModelIndex index = d->indexForItem(item);
|
||||
if (!index.isValid()) {
|
||||
continue;
|
||||
|
|
|
@ -173,7 +173,7 @@ QVariantList DocumentItem::bookmarkedPages() const
|
|||
std::sort(list.begin(), list.end());
|
||||
|
||||
QVariantList variantList;
|
||||
for (const int page : qAsConst(list)) {
|
||||
for (const int page : std::as_const(list)) {
|
||||
variantList << page;
|
||||
}
|
||||
return variantList;
|
||||
|
|
|
@ -357,7 +357,7 @@ void AnnotationActionHandlerPrivate::populateQuickAnnotations()
|
|||
q->deselectAllAnnotationActions();
|
||||
}
|
||||
|
||||
for (QAction *action : qAsConst(quickTools)) {
|
||||
for (QAction *action : std::as_const(quickTools)) {
|
||||
aQuickTools->removeAction(action);
|
||||
aQuickToolsBar->removeAction(action);
|
||||
delete action;
|
||||
|
@ -827,10 +827,10 @@ void AnnotationActionHandler::setToolsEnabled(bool on)
|
|||
void AnnotationActionHandler::setTextToolsEnabled(bool on)
|
||||
{
|
||||
d->textToolsEnabled = on;
|
||||
for (QAction *ann : qAsConst(d->textTools)) {
|
||||
for (QAction *ann : std::as_const(d->textTools)) {
|
||||
ann->setEnabled(on);
|
||||
}
|
||||
for (QAction *ann : qAsConst(d->textQuickTools)) {
|
||||
for (QAction *ann : std::as_const(d->textQuickTools)) {
|
||||
ann->setEnabled(on);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ static void updateAnnotationPointer(AnnItem *item, const QVector<Okular::Page *>
|
|||
}
|
||||
}
|
||||
|
||||
for (AnnItem *child : qAsConst(item->children)) {
|
||||
for (AnnItem *child : std::as_const(item->children)) {
|
||||
updateAnnotationPointer(child, pages);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,12 +99,12 @@ void AnnotationPopup::addActionsToMenu(QMenu *menu)
|
|||
action = menu->addAction(QIcon::fromTheme(QStringLiteral("list-remove")), i18n("&Delete"));
|
||||
action->setEnabled(mDocument->isAllowed(Okular::AllowNotes));
|
||||
connect(action, &QAction::triggered, menu, [this] {
|
||||
for (const AnnotPagePair &pair : qAsConst(mAnnotations)) {
|
||||
for (const AnnotPagePair &pair : std::as_const(mAnnotations)) {
|
||||
doRemovePageAnnotation(pair);
|
||||
}
|
||||
});
|
||||
|
||||
for (const AnnotPagePair &annot : qAsConst(mAnnotations)) {
|
||||
for (const AnnotPagePair &annot : std::as_const(mAnnotations)) {
|
||||
if (!mDocument->canRemovePageAnnotation(annot.annotation)) {
|
||||
action->setEnabled(false);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void AnnotationPopup::addActionsToMenu(QMenu *menu)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
for (const AnnotPagePair &pair : qAsConst(mAnnotations)) {
|
||||
for (const AnnotPagePair &pair : std::as_const(mAnnotations)) {
|
||||
menu->addAction(new OKMenuTitle(menu, GuiUtils::captionForAnnotation(pair.annotation)));
|
||||
|
||||
action = menu->addAction(QIcon::fromTheme(QStringLiteral("comment")), i18n("&Open Pop-up Note"));
|
||||
|
|
|
@ -116,7 +116,7 @@ void DrawingToolActions::actionTriggered()
|
|||
|
||||
if (action) {
|
||||
if (action->isChecked()) {
|
||||
for (QAction *btn : qAsConst(m_actions)) {
|
||||
for (QAction *btn : std::as_const(m_actions)) {
|
||||
if (action != btn) {
|
||||
btn->setChecked(false);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ LatexRenderer::LatexRenderer()
|
|||
|
||||
LatexRenderer::~LatexRenderer()
|
||||
{
|
||||
for (const QString &file : qAsConst(m_fileList)) {
|
||||
for (const QString &file : std::as_const(m_fileList)) {
|
||||
QFile::remove(file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ void MiniBarLogic::notifySetup(const QVector<Okular::Page *> &pageVector, int se
|
|||
// if document is closed or has no pages, hide widget
|
||||
const int pages = pageVector.count();
|
||||
if (pages < 1) {
|
||||
for (MiniBar *miniBar : qAsConst(m_miniBars)) {
|
||||
for (MiniBar *miniBar : std::as_const(m_miniBars)) {
|
||||
miniBar->setEnabled(false);
|
||||
}
|
||||
return;
|
||||
|
@ -107,7 +107,7 @@ void MiniBarLogic::notifySetup(const QVector<Okular::Page *> &pageVector, int se
|
|||
}
|
||||
}
|
||||
|
||||
for (MiniBar *miniBar : qAsConst(m_miniBars)) {
|
||||
for (MiniBar *miniBar : std::as_const(m_miniBars)) {
|
||||
// resize width of widgets
|
||||
miniBar->resizeForPage(pages, pagesOrLabelString);
|
||||
|
||||
|
@ -139,7 +139,7 @@ void MiniBarLogic::notifyCurrentPageChanged(int previousPage, int currentPage)
|
|||
const QString pageNumber = QString::number(currentPage + 1);
|
||||
const QString pageLabel = m_document->page(currentPage)->label();
|
||||
|
||||
for (MiniBar *miniBar : qAsConst(m_miniBars)) {
|
||||
for (MiniBar *miniBar : std::as_const(m_miniBars)) {
|
||||
// update prev/next button state
|
||||
miniBar->m_prevButton->setEnabled(currentPage > 0);
|
||||
miniBar->m_nextButton->setEnabled(currentPage < (pages - 1));
|
||||
|
|
|
@ -879,7 +879,7 @@ void PageView::openAnnotationWindow(Okular::Annotation *annotation, int pageNumb
|
|||
|
||||
// find the annot window
|
||||
AnnotWindow *existWindow = nullptr;
|
||||
for (AnnotWindow *aw : qAsConst(d->m_annowindows)) {
|
||||
for (AnnotWindow *aw : std::as_const(d->m_annowindows)) {
|
||||
if (aw->annotation() == annotation) {
|
||||
existWindow = aw;
|
||||
break;
|
||||
|
@ -1057,7 +1057,7 @@ QMimeData *PageView::getTableContents() const
|
|||
selText += QLatin1Char('\t');
|
||||
}
|
||||
QString txt;
|
||||
for (const TableSelectionPart &tsp : qAsConst(d->tableSelectionParts)) {
|
||||
for (const TableSelectionPart &tsp : std::as_const(d->tableSelectionParts)) {
|
||||
// first, crop the cell to this part
|
||||
if (!tsp.rectInSelection.intersects(cell)) {
|
||||
continue;
|
||||
|
@ -1139,7 +1139,7 @@ void PageView::copyTextSelection() const
|
|||
|
||||
void PageView::selectAll()
|
||||
{
|
||||
for (const PageViewItem *item : qAsConst(d->items)) {
|
||||
for (const PageViewItem *item : std::as_const(d->items)) {
|
||||
Okular::RegularAreaRect *area = textSelectionForItem(item);
|
||||
d->pagesWithTextSelection.insert(item->pageNumber());
|
||||
d->document->setPageTextSelection(item->pageNumber(), area, palette().color(QPalette::Active, QPalette::Highlight));
|
||||
|
@ -1204,7 +1204,7 @@ void PageView::notifySetup(const QVector<Okular::Page *> &pageSet, int setupFlag
|
|||
// around so we can look for the new ones using unique ids, etc
|
||||
d->mouseAnnotation->updateAnnotationPointers();
|
||||
|
||||
for (AnnotWindow *aw : qAsConst(d->m_annowindows)) {
|
||||
for (AnnotWindow *aw : std::as_const(d->m_annowindows)) {
|
||||
Okular::Annotation *newA = d->document->page(aw->pageNumber())->annotation(aw->annotation()->uniqueName());
|
||||
aw->updateAnnotation(newA);
|
||||
}
|
||||
|
@ -1450,7 +1450,7 @@ void PageView::slotRealNotifyViewportChanged(bool smoothMove)
|
|||
// find PageViewItem matching the viewport description
|
||||
const Okular::DocumentViewport &vp = d->document->viewport();
|
||||
const PageViewItem *item = nullptr;
|
||||
for (const PageViewItem *tmpItem : qAsConst(d->items)) {
|
||||
for (const PageViewItem *tmpItem : std::as_const(d->items)) {
|
||||
if (tmpItem->pageNumber() == vp.pageNumber) {
|
||||
item = tmpItem;
|
||||
break;
|
||||
|
@ -1533,7 +1533,7 @@ void PageView::notifyPageChanged(int pageNumber, int changedFlags)
|
|||
}
|
||||
|
||||
// iterate over visible items: if page(pageNumber) is one of them, repaint it
|
||||
for (const PageViewItem *visibleItem : qAsConst(d->visibleItems)) {
|
||||
for (const PageViewItem *visibleItem : std::as_const(d->visibleItems)) {
|
||||
if (visibleItem->pageNumber() == pageNumber && visibleItem->isVisible()) {
|
||||
// update item's rectangle plus the little outline
|
||||
QRect expandedRect = visibleItem->croppedGeometry();
|
||||
|
@ -1575,14 +1575,14 @@ bool PageView::canUnloadPixmap(int pageNumber) const
|
|||
{
|
||||
if (Okular::SettingsCore::memoryLevel() == Okular::SettingsCore::EnumMemoryLevel::Low || Okular::SettingsCore::memoryLevel() == Okular::SettingsCore::EnumMemoryLevel::Normal) {
|
||||
// if the item is visible, forbid unloading
|
||||
for (const PageViewItem *visibleItem : qAsConst(d->visibleItems)) {
|
||||
for (const PageViewItem *visibleItem : std::as_const(d->visibleItems)) {
|
||||
if (visibleItem->pageNumber() == pageNumber) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// forbid unloading of the visible items, and of the previous and next
|
||||
for (const PageViewItem *visibleItem : qAsConst(d->visibleItems)) {
|
||||
for (const PageViewItem *visibleItem : std::as_const(d->visibleItems)) {
|
||||
if (abs(visibleItem->pageNumber() - pageNumber) <= 1) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1919,7 +1919,7 @@ void PageView::paintEvent(QPaintEvent *pe)
|
|||
pixmapPainter.drawRect(selectionRect.adjusted(0, 0, -1, -1));
|
||||
}
|
||||
// 2b) Layer 1b: paint (blend) transparent selection (table)
|
||||
for (const TableSelectionPart &tsp : qAsConst(d->tableSelectionParts)) {
|
||||
for (const TableSelectionPart &tsp : std::as_const(d->tableSelectionParts)) {
|
||||
QRect selectionPartRect = tsp.rectInItem.geometry(tsp.item->uncroppedWidth(), tsp.item->uncroppedHeight());
|
||||
selectionPartRect.translate(tsp.item->uncroppedGeometry().topLeft());
|
||||
QRect selectionPartRectInternal = selectionPartRect;
|
||||
|
@ -1978,7 +1978,7 @@ void PageView::paintEvent(QPaintEvent *pe)
|
|||
screenPainter.drawRect(selectionRect);
|
||||
}
|
||||
// 2b) Layer 1b: paint opaque selection (table)
|
||||
for (const TableSelectionPart &tsp : qAsConst(d->tableSelectionParts)) {
|
||||
for (const TableSelectionPart &tsp : std::as_const(d->tableSelectionParts)) {
|
||||
QRect selectionPartRect = tsp.rectInItem.geometry(tsp.item->uncroppedWidth(), tsp.item->uncroppedHeight());
|
||||
selectionPartRect.translate(tsp.item->uncroppedGeometry().topLeft());
|
||||
QRect selectionPartRectInternal = selectionPartRect;
|
||||
|
@ -2014,19 +2014,19 @@ void PageView::drawTableDividers(QPainter *screenPainter)
|
|||
p.setStyle(Qt::DashLine);
|
||||
screenPainter->setPen(p);
|
||||
}
|
||||
for (const TableSelectionPart &tsp : qAsConst(d->tableSelectionParts)) {
|
||||
for (const TableSelectionPart &tsp : std::as_const(d->tableSelectionParts)) {
|
||||
QRect selectionPartRect = tsp.rectInItem.geometry(tsp.item->uncroppedWidth(), tsp.item->uncroppedHeight());
|
||||
selectionPartRect.translate(tsp.item->uncroppedGeometry().topLeft());
|
||||
QRect selectionPartRectInternal = selectionPartRect;
|
||||
selectionPartRectInternal.adjust(1, 1, -1, -1);
|
||||
for (double col : qAsConst(d->tableSelectionCols)) {
|
||||
for (double col : std::as_const(d->tableSelectionCols)) {
|
||||
if (col >= tsp.rectInSelection.left && col <= tsp.rectInSelection.right) {
|
||||
col = (col - tsp.rectInSelection.left) / (tsp.rectInSelection.right - tsp.rectInSelection.left);
|
||||
const int x = selectionPartRect.left() + col * selectionPartRect.width() + 0.5;
|
||||
screenPainter->drawLine(x, selectionPartRectInternal.top(), x, selectionPartRectInternal.top() + selectionPartRectInternal.height());
|
||||
}
|
||||
}
|
||||
for (double row : qAsConst(d->tableSelectionRows)) {
|
||||
for (double row : std::as_const(d->tableSelectionRows)) {
|
||||
if (row >= tsp.rectInSelection.top && row <= tsp.rectInSelection.bottom) {
|
||||
row = (row - tsp.rectInSelection.top) / (tsp.rectInSelection.bottom - tsp.rectInSelection.top);
|
||||
const int y = selectionPartRect.top() + row * selectionPartRect.height() + 0.5;
|
||||
|
@ -2474,7 +2474,7 @@ void PageView::mousePressEvent(QMouseEvent *e)
|
|||
selectionStart(eventPos, palette().color(QPalette::Active, QPalette::Highlight).lighter(120), false);
|
||||
} else {
|
||||
QRect updatedRect;
|
||||
for (const TableSelectionPart &tsp : qAsConst(d->tableSelectionParts)) {
|
||||
for (const TableSelectionPart &tsp : std::as_const(d->tableSelectionParts)) {
|
||||
QRect selectionPartRect = tsp.rectInItem.geometry(tsp.item->uncroppedWidth(), tsp.item->uncroppedHeight());
|
||||
selectionPartRect.translate(tsp.item->uncroppedGeometry().topLeft());
|
||||
|
||||
|
@ -2833,7 +2833,7 @@ void PageView::mouseReleaseEvent(QMouseEvent *e)
|
|||
if (d->document->supportsSearching()) {
|
||||
// grab text in selection by extracting it from all intersected pages
|
||||
const Okular::Page *okularPage = nullptr;
|
||||
for (const PageViewItem *item : qAsConst(d->items)) {
|
||||
for (const PageViewItem *item : std::as_const(d->items)) {
|
||||
if (!item->isVisible()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -2982,7 +2982,7 @@ void PageView::mouseReleaseEvent(QMouseEvent *e)
|
|||
// break up the selection into page-relative pieces
|
||||
d->tableSelectionParts.clear();
|
||||
const Okular::Page *okularPage = nullptr;
|
||||
for (PageViewItem *item : qAsConst(d->items)) {
|
||||
for (PageViewItem *item : std::as_const(d->items)) {
|
||||
if (!item->isVisible()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -3125,7 +3125,7 @@ void PageView::guessTableDividers()
|
|||
{
|
||||
QList<QPair<double, int>> colTicks, rowTicks, colSelectionTicks, rowSelectionTicks;
|
||||
|
||||
for (const TableSelectionPart &tsp : qAsConst(d->tableSelectionParts)) {
|
||||
for (const TableSelectionPart &tsp : std::as_const(d->tableSelectionParts)) {
|
||||
// add ticks for the edges of this area...
|
||||
colSelectionTicks.append(qMakePair(tsp.rectInSelection.left, +1));
|
||||
colSelectionTicks.append(qMakePair(tsp.rectInSelection.right, -1));
|
||||
|
@ -3389,7 +3389,7 @@ QList<Okular::RegularAreaRect *> PageView::textSelections(const QPoint start, co
|
|||
QList<Okular::RegularAreaRect *> ret;
|
||||
QSet<int> affectedItemsSet;
|
||||
QRect selectionRect = QRect(start, end).normalized();
|
||||
for (const PageViewItem *item : qAsConst(d->items)) {
|
||||
for (const PageViewItem *item : std::as_const(d->items)) {
|
||||
if (item->isVisible() && selectionRect.intersects(item->croppedGeometry())) {
|
||||
affectedItemsSet.insert(item->pageNumber());
|
||||
}
|
||||
|
@ -3404,7 +3404,7 @@ QList<Okular::RegularAreaRect *> PageView::textSelections(const QPoint start, co
|
|||
|
||||
int tmpmin = d->document->pages();
|
||||
int tmpmax = 0;
|
||||
for (const int p : qAsConst(affectedItemsSet)) {
|
||||
for (const int p : std::as_const(affectedItemsSet)) {
|
||||
if (p < tmpmin) {
|
||||
tmpmin = p;
|
||||
}
|
||||
|
@ -3445,7 +3445,7 @@ QList<Okular::RegularAreaRect *> PageView::textSelections(const QPoint start, co
|
|||
affectedItemsIds.removeFirst();
|
||||
affectedItemsIds.removeLast();
|
||||
// item between the two above
|
||||
for (const int page : qAsConst(affectedItemsIds)) {
|
||||
for (const int page : std::as_const(affectedItemsIds)) {
|
||||
ret.append(textSelectionForItem(d->items[page]));
|
||||
}
|
||||
ret.append(lastArea);
|
||||
|
@ -3469,7 +3469,7 @@ void PageView::drawDocumentOnPainter(const QRect contentsRect, QPainter *p)
|
|||
|
||||
// This loop draws the actual pages
|
||||
// iterate over all items painting the ones intersecting contentsRect
|
||||
for (const PageViewItem *item : qAsConst(d->items)) {
|
||||
for (const PageViewItem *item : std::as_const(d->items)) {
|
||||
// check if a piece of the page intersects the contents rect
|
||||
if (!item->isVisible() || !item->croppedGeometry().intersects(contentsRect)) {
|
||||
continue;
|
||||
|
@ -3516,7 +3516,7 @@ void PageView::drawDocumentOnPainter(const QRect contentsRect, QPainter *p)
|
|||
static const int shadowWidth = 2 * dpr;
|
||||
|
||||
// iterate over all items painting a black outline and a simple bottom/right gradient
|
||||
for (const PageViewItem *item : qAsConst(d->items)) {
|
||||
for (const PageViewItem *item : std::as_const(d->items)) {
|
||||
// check if a piece of the page intersects the contents rect
|
||||
if (!item->isVisible() || !item->croppedGeometry().intersects(checkRect)) {
|
||||
continue;
|
||||
|
@ -3664,7 +3664,7 @@ void PageView::updateItemSize(PageViewItem *item, int colWidth, int rowHeight)
|
|||
PageViewItem *PageView::pickItemOnPoint(int x, int y)
|
||||
{
|
||||
PageViewItem *item = nullptr;
|
||||
for (PageViewItem *i : qAsConst(d->visibleItems)) {
|
||||
for (PageViewItem *i : std::as_const(d->visibleItems)) {
|
||||
const QRect &r = i->croppedGeometry();
|
||||
if (x < r.right() && x > r.left() && y < r.bottom()) {
|
||||
if (y > r.top()) {
|
||||
|
@ -3680,7 +3680,7 @@ void PageView::textSelectionClear()
|
|||
{
|
||||
// something to clear
|
||||
if (!d->pagesWithTextSelection.isEmpty()) {
|
||||
for (const int page : qAsConst(d->pagesWithTextSelection)) {
|
||||
for (const int page : std::as_const(d->pagesWithTextSelection)) {
|
||||
d->document->setPageTextSelection(page, nullptr, QColor());
|
||||
}
|
||||
d->pagesWithTextSelection.clear();
|
||||
|
@ -3785,7 +3785,7 @@ void PageView::updateSelection(const QPoint pos)
|
|||
d->document->setPageTextSelection(p, nullptr, QColor());
|
||||
}
|
||||
// set the new selection for the selected pages
|
||||
for (int p : qAsConst(pagesWithSelectionSet)) {
|
||||
for (int p : std::as_const(pagesWithSelectionSet)) {
|
||||
d->document->setPageTextSelection(p, selections[p - first], palette().color(QPalette::Active, QPalette::Highlight));
|
||||
}
|
||||
d->pagesWithTextSelection = pagesWithSelectionSet;
|
||||
|
@ -3848,7 +3848,7 @@ void PageView::selectionClear(const ClearMode mode)
|
|||
d->tableSelectionCols.clear();
|
||||
d->tableSelectionRows.clear();
|
||||
d->tableDividersGuessed = false;
|
||||
for (const TableSelectionPart &tsp : qAsConst(d->tableSelectionParts)) {
|
||||
for (const TableSelectionPart &tsp : std::as_const(d->tableSelectionParts)) {
|
||||
QRect selectionPartRect = tsp.rectInItem.geometry(tsp.item->uncroppedWidth(), tsp.item->uncroppedHeight());
|
||||
selectionPartRect.translate(tsp.item->uncroppedGeometry().topLeft());
|
||||
// should check whether this is on-screen here?
|
||||
|
@ -4207,7 +4207,7 @@ void PageView::updateCursor(const QPoint p)
|
|||
void PageView::reloadForms()
|
||||
{
|
||||
if (d->m_formsVisible) {
|
||||
for (PageViewItem *item : qAsConst(d->visibleItems)) {
|
||||
for (PageViewItem *item : std::as_const(d->visibleItems)) {
|
||||
item->reloadFormWidgetsState();
|
||||
}
|
||||
}
|
||||
|
@ -4315,7 +4315,7 @@ void PageView::scrollTo(int x, int y, bool smoothMove)
|
|||
void PageView::toggleFormWidgets(bool on)
|
||||
{
|
||||
bool somehadfocus = false;
|
||||
for (PageViewItem *item : qAsConst(d->items)) {
|
||||
for (PageViewItem *item : std::as_const(d->items)) {
|
||||
const bool hadfocus = item->setFormWidgetsVisible(on);
|
||||
somehadfocus = somehadfocus || hadfocus;
|
||||
}
|
||||
|
@ -4605,7 +4605,7 @@ void PageView::slotRelayoutPages()
|
|||
|
||||
// 1) find the maximum columns width and rows height for a grid in
|
||||
// which each page must well-fit inside a cell
|
||||
for (PageViewItem *item : qAsConst(d->items)) {
|
||||
for (PageViewItem *item : std::as_const(d->items)) {
|
||||
// update internal page size (leaving a little margin in case of Fit* modes)
|
||||
updateItemSize(item, colWidth[cIdx] - kcolWidthMargin, viewportHeight - krowHeightMargin);
|
||||
// find row's maximum height and column's max width
|
||||
|
@ -4648,7 +4648,7 @@ void PageView::slotRelayoutPages()
|
|||
insertX += colWidth[i];
|
||||
}
|
||||
}
|
||||
for (PageViewItem *item : qAsConst(d->items)) {
|
||||
for (PageViewItem *item : std::as_const(d->items)) {
|
||||
int cWidth = colWidth[cIdx], rHeight = rowHeight[rIdx];
|
||||
if (continuousView || rIdx == pageRowIdx) {
|
||||
const bool reallyDoCenterFirst = item->pageNumber() == 0 && centerFirstPage;
|
||||
|
@ -4798,7 +4798,7 @@ void PageView::slotRequestVisiblePixmaps(int newValue)
|
|||
d->visibleItems.clear();
|
||||
QList<Okular::PixmapRequest *> requestedPixmaps;
|
||||
QVector<Okular::VisiblePageRect *> visibleRects;
|
||||
for (PageViewItem *i : qAsConst(d->items)) {
|
||||
for (PageViewItem *i : std::as_const(d->items)) {
|
||||
const QSet<FormWidgetIface *> formWidgetsList = i->formWidgets();
|
||||
for (FormWidgetIface *fwi : formWidgetsList) {
|
||||
Okular::NormalizedRect r = fwi->rect();
|
||||
|
@ -5380,7 +5380,7 @@ void PageView::slotFormChanged(int pageNumber)
|
|||
|
||||
void PageView::slotRefreshPage()
|
||||
{
|
||||
for (int req : qAsConst(d->refreshPages)) {
|
||||
for (int req : std::as_const(d->refreshPages)) {
|
||||
QTimer::singleShot(0, this, [this, req] { d->document->refreshPixmaps(req); });
|
||||
}
|
||||
d->refreshPages.clear();
|
||||
|
@ -5390,7 +5390,7 @@ void PageView::slotRefreshPage()
|
|||
void PageView::slotSpeakDocument()
|
||||
{
|
||||
QString text;
|
||||
for (const PageViewItem *item : qAsConst(d->items)) {
|
||||
for (const PageViewItem *item : std::as_const(d->items)) {
|
||||
Okular::RegularAreaRect *area = textSelectionForItem(item);
|
||||
text.append(item->page()->text(area));
|
||||
text.append(QLatin1Char('\n'));
|
||||
|
@ -5542,7 +5542,7 @@ void PageView::slotFitWindowToPage()
|
|||
{
|
||||
const PageViewItem *currentPageItem = nullptr;
|
||||
QSize viewportSize = viewport()->size();
|
||||
for (const PageViewItem *pageItem : qAsConst(d->items)) {
|
||||
for (const PageViewItem *pageItem : std::as_const(d->items)) {
|
||||
if (pageItem->isVisible()) {
|
||||
currentPageItem = pageItem;
|
||||
break;
|
||||
|
|
|
@ -684,7 +684,7 @@ public:
|
|||
QColor col = m_engineColor;
|
||||
col.setAlphaF(0.5);
|
||||
painter->setBrush(col);
|
||||
for (const Okular::NormalizedRect &r : qAsConst(*selection)) {
|
||||
for (const Okular::NormalizedRect &r : std::as_const(*selection)) {
|
||||
painter->drawRect(r.geometry((int)xScale, (int)yScale));
|
||||
}
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ public:
|
|||
Okular::HighlightAnnotation *ha = new Okular::HighlightAnnotation();
|
||||
ha->setHighlightType(type);
|
||||
ha->setBoundingRectangle(Okular::NormalizedRect(rect, item()->uncroppedWidth(), item()->uncroppedHeight()));
|
||||
for (const Okular::NormalizedRect &r : qAsConst(*selection)) {
|
||||
for (const Okular::NormalizedRect &r : std::as_const(*selection)) {
|
||||
Okular::HighlightAnnotation::Quad q;
|
||||
q.setCapStart(false);
|
||||
q.setCapEnd(false);
|
||||
|
|
|
@ -257,7 +257,7 @@ void MouseAnnotation::routePaint(QPainter *painter, const QRect paintRect)
|
|||
if (m_focusedAnnotation.annotation->canBeResized()) {
|
||||
painter->setPen(borderColor);
|
||||
painter->setBrush(fillColor);
|
||||
for (const ResizeHandle &handle : qAsConst(m_resizeHandleList)) {
|
||||
for (const ResizeHandle &handle : std::as_const(m_resizeHandleList)) {
|
||||
QRect rect = getHandleRect(handle, m_focusedAnnotation);
|
||||
painter->drawRect(rect);
|
||||
}
|
||||
|
|
|
@ -124,11 +124,11 @@ void PageViewItem::setWHZC(int w, int h, double z, const Okular::NormalizedRect
|
|||
m_crop = c;
|
||||
m_uncroppedGeometry.setWidth(qRound(w / (c.right - c.left)));
|
||||
m_uncroppedGeometry.setHeight(qRound(h / (c.bottom - c.top)));
|
||||
for (FormWidgetIface *fwi : qAsConst(m_formWidgets)) {
|
||||
for (FormWidgetIface *fwi : std::as_const(m_formWidgets)) {
|
||||
Okular::NormalizedRect r = fwi->rect();
|
||||
fwi->setWidthHeight(qRound(fabs(r.right - r.left) * m_uncroppedGeometry.width()), qRound(fabs(r.bottom - r.top) * m_uncroppedGeometry.height()));
|
||||
}
|
||||
for (VideoWidget *vw : qAsConst(m_videoWidgets)) {
|
||||
for (VideoWidget *vw : std::as_const(m_videoWidgets)) {
|
||||
const Okular::NormalizedRect r = vw->normGeometry();
|
||||
vw->resize(qRound(fabs(r.right - r.left) * m_uncroppedGeometry.width()), qRound(fabs(r.bottom - r.top) * m_uncroppedGeometry.height()));
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ void PageViewItem::moveTo(int x, int y)
|
|||
Okular::NormalizedRect r = (*it)->rect();
|
||||
(*it)->moveTo(qRound(x + m_uncroppedGeometry.width() * r.left) + 1, qRound(y + m_uncroppedGeometry.height() * r.top) + 1);
|
||||
}
|
||||
for (VideoWidget *vw : qAsConst(m_videoWidgets)) {
|
||||
for (VideoWidget *vw : std::as_const(m_videoWidgets)) {
|
||||
const Okular::NormalizedRect r = vw->normGeometry();
|
||||
vw->move(qRound(x + m_uncroppedGeometry.width() * r.left) + 1, qRound(y + m_uncroppedGeometry.height() * r.top) + 1);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ bool PageViewItem::setFormWidgetsVisible(bool visible)
|
|||
|
||||
void PageViewItem::reloadFormWidgetsState()
|
||||
{
|
||||
for (FormWidgetIface *fwi : qAsConst(m_formWidgets)) {
|
||||
for (FormWidgetIface *fwi : std::as_const(m_formWidgets)) {
|
||||
fwi->setVisibility(fwi->formField()->isVisible() && FormWidgetsController::shouldFormWidgetBeShown(fwi->formField()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ struct PresentationFrame {
|
|||
}
|
||||
geometry.setRect((width - pageWidth) / 2, (height - pageHeight) / 2, pageWidth, pageHeight);
|
||||
|
||||
for (VideoWidget *vw : qAsConst(videoWidgets)) {
|
||||
for (VideoWidget *vw : std::as_const(videoWidgets)) {
|
||||
const Okular::NormalizedRect r = vw->normGeometry();
|
||||
QRect vwgeom = r.geometry(geometry.width(), geometry.height());
|
||||
vw->resize(vwgeom.size());
|
||||
|
@ -407,7 +407,7 @@ void PresentationWidget::notifyCurrentPageChanged(int previousPage, int currentP
|
|||
{
|
||||
if (previousPage != -1) {
|
||||
// stop video playback
|
||||
for (VideoWidget *vw : qAsConst(m_frames[previousPage]->videoWidgets)) {
|
||||
for (VideoWidget *vw : std::as_const(m_frames[previousPage]->videoWidgets)) {
|
||||
vw->stop();
|
||||
vw->pageLeft();
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ void PresentationWidget::notifyCurrentPageChanged(int previousPage, int currentP
|
|||
}
|
||||
|
||||
// start autoplay video playback
|
||||
for (VideoWidget *vw : qAsConst(m_frames[m_frameIndex]->videoWidgets)) {
|
||||
for (VideoWidget *vw : std::as_const(m_frames[m_frameIndex]->videoWidgets)) {
|
||||
vw->pageEntered();
|
||||
}
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ void PresentationWidget::resizeEvent(QResizeEvent *re)
|
|||
// BEGIN Content area
|
||||
// update the frames
|
||||
const float screenRatio = (float)m_height / (float)m_width;
|
||||
for (PresentationFrame *frame : qAsConst(m_frames)) {
|
||||
for (PresentationFrame *frame : std::as_const(m_frames)) {
|
||||
frame->recalcGeometry(m_width, m_height, screenRatio);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
|
|||
}
|
||||
}
|
||||
|
||||
for (const QString &key : qAsConst(orderedProperties)) {
|
||||
for (const QString &key : std::as_const(orderedProperties)) {
|
||||
const QString titleString = info.getKeyTitle(key);
|
||||
const QString valueString = info.get(key);
|
||||
if (titleString.isNull() || valueString.isNull()) {
|
||||
|
|
|
@ -237,7 +237,7 @@ std::optional<SigningInformation> getCertificateAndPasswordForSigning(PageView *
|
|||
int selectIndex = 0;
|
||||
auto config = KSharedConfig::openConfig();
|
||||
const QString lastNick = config->group(ConfigGroup).readEntry<QString>(ConfigLastKeyNick, QString());
|
||||
for (const auto &cert : qAsConst(certs)) {
|
||||
for (const auto &cert : std::as_const(certs)) {
|
||||
auto item = std::make_unique<QStandardItem>();
|
||||
QString commonName = cert.subjectInfo(Okular::CertificateInfo::CommonName, Okular::CertificateInfo::EmptyString::Empty);
|
||||
item->setData(commonName, Qt::UserRole);
|
||||
|
|
|
@ -88,7 +88,7 @@ Qt::ToolButtonStyle ToggleActionMenu::styleFor(QToolButton *button) const
|
|||
|
||||
void ToggleActionMenu::updateButtons()
|
||||
{
|
||||
for (QToolButton *button : qAsConst(m_buttons)) {
|
||||
for (QToolButton *button : std::as_const(m_buttons)) {
|
||||
if (button) {
|
||||
button->setDefaultAction(this->defaultAction());
|
||||
// If *this action* is low priority we need to tell the button
|
||||
|
|
|
@ -305,7 +305,7 @@ Shell::Shell(const QString &serializedOptions)
|
|||
|
||||
void Shell::reloadAllXML()
|
||||
{
|
||||
for (const TabState &tab : qAsConst(m_tabs)) {
|
||||
for (const TabState &tab : std::as_const(m_tabs)) {
|
||||
tab.part->reloadXML();
|
||||
}
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ Shell::~Shell()
|
|||
{
|
||||
if (!m_tabs.empty()) {
|
||||
writeSettings();
|
||||
for (const TabState &tab : qAsConst(m_tabs)) {
|
||||
for (const TabState &tab : std::as_const(m_tabs)) {
|
||||
tab.part->closeUrl(false);
|
||||
}
|
||||
m_tabs.clear();
|
||||
|
@ -585,7 +585,7 @@ void Shell::saveProperties(KConfigGroup &group)
|
|||
|
||||
// Gather lists of settings to preserve
|
||||
QStringList urls;
|
||||
for (const TabState &tab : qAsConst(m_tabs)) {
|
||||
for (const TabState &tab : std::as_const(m_tabs)) {
|
||||
urls.append(tab.part->url().url());
|
||||
}
|
||||
group.writePathEntry(SESSION_URL_KEY, urls);
|
||||
|
@ -646,7 +646,7 @@ void Shell::fileOpen()
|
|||
const bool useMimeTypeFilters = qgetenv("XDG_CURRENT_DESKTOP").toLower() == "kde";
|
||||
if (useMimeTypeFilters) {
|
||||
QStringList mimetypes;
|
||||
for (const QString &mimeName : qAsConst(m_fileformats)) {
|
||||
for (const QString &mimeName : std::as_const(m_fileformats)) {
|
||||
QMimeType mimeType = mimeDatabase.mimeTypeForName(mimeName);
|
||||
mimetypes << mimeType.name();
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ void Shell::fileOpen()
|
|||
} else {
|
||||
QSet<QString> globPatterns;
|
||||
QMap<QString, QStringList> namedGlobs;
|
||||
for (const QString &mimeName : qAsConst(m_fileformats)) {
|
||||
for (const QString &mimeName : std::as_const(m_fileformats)) {
|
||||
QMimeType mimeType = mimeDatabase.mimeTypeForName(mimeName);
|
||||
const QStringList globs(mimeType.globPatterns());
|
||||
if (globs.isEmpty()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user