diff --git a/src/lib/3rdparty/squeezelabelv1.cpp b/src/lib/3rdparty/squeezelabelv1.cpp index 53b82c996..67626afc0 100644 --- a/src/lib/3rdparty/squeezelabelv1.cpp +++ b/src/lib/3rdparty/squeezelabelv1.cpp @@ -38,7 +38,7 @@ void SqueezeLabelV1::paintEvent(QPaintEvent* event) if (m_SqueezedTextCache != text()) { m_SqueezedTextCache = text(); QFontMetrics fm = fontMetrics(); - if (fm.width(m_SqueezedTextCache) > contentsRect().width()) { + if (fm.horizontalAdvance(m_SqueezedTextCache) > contentsRect().width()) { QString elided = fm.elidedText(text(), Qt::ElideMiddle, width()); setText(elided); } diff --git a/src/lib/3rdparty/stylehelper.cpp b/src/lib/3rdparty/stylehelper.cpp index 09a4cd40d..ca0372aa7 100644 --- a/src/lib/3rdparty/stylehelper.cpp +++ b/src/lib/3rdparty/stylehelper.cpp @@ -155,9 +155,9 @@ void StyleHelper::verticalGradient(QPainter* painter, const QRect &spanRect, con if (StyleHelper::usePixmapCache()) { QString key; QColor keyColor = baseColor(lightColored); - key.sprintf("mh_vertical %d %d %d %d %d", - spanRect.width(), spanRect.height(), clipRect.width(), - clipRect.height(), keyColor.rgb()); + key.asprintf("mh_vertical %d %d %d %d %d", + spanRect.width(), spanRect.height(), clipRect.width(), + clipRect.height(), keyColor.rgb()); QPixmap pixmap; if (!QPixmapCache::find(key, pixmap)) { diff --git a/src/lib/adblock/adblocksubscription.cpp b/src/lib/adblock/adblocksubscription.cpp index 89c72b1ed..c8cf58686 100644 --- a/src/lib/adblock/adblocksubscription.cpp +++ b/src/lib/adblock/adblocksubscription.cpp @@ -309,10 +309,10 @@ void AdBlockCustomList::loadSubscription(const QStringList &disabledRules) stream.setCodec("UTF-8"); if (!rules.contains(ddg1 + QL1S("\n"))) - stream << ddg1 << endl; + stream << ddg1 << Qt::endl; if (!rules.contains(QL1S("\n") + ddg2)) - stream << ddg2 << endl; + stream << ddg2 << Qt::endl; } file.close(); @@ -330,12 +330,12 @@ void AdBlockCustomList::saveSubscription() QTextStream textStream(&file); textStream.setCodec("UTF-8"); - textStream << "Title: " << title() << endl; - textStream << "Url: " << url().toString() << endl; - textStream << "[Adblock Plus 1.1.1]" << endl; + textStream << "Title: " << title() << Qt::endl; + textStream << "Url: " << url().toString() << Qt::endl; + textStream << "[Adblock Plus 1.1.1]" << Qt::endl; for (const AdBlockRule* rule : qAsConst(m_rules)) { - textStream << rule->filter() << endl; + textStream << rule->filter() << Qt::endl; } file.close(); diff --git a/src/lib/bookmarks/bookmarkitem.cpp b/src/lib/bookmarks/bookmarkitem.cpp index 47abd0b72..0d53382b1 100644 --- a/src/lib/bookmarks/bookmarkitem.cpp +++ b/src/lib/bookmarks/bookmarkitem.cpp @@ -77,7 +77,7 @@ QIcon BookmarkItem::icon() switch (m_type) { case Url: - if (m_iconTime.isNull() || m_iconTime.elapsed() > iconCacheTime) { + if ((!m_iconTime.isValid()) || (m_iconTime.elapsed() > iconCacheTime)) { m_icon = IconProvider::iconForUrl(m_url); m_iconTime.restart(); } diff --git a/src/lib/bookmarks/bookmarkitem.h b/src/lib/bookmarks/bookmarkitem.h index cabe85587..eaea42447 100644 --- a/src/lib/bookmarks/bookmarkitem.h +++ b/src/lib/bookmarks/bookmarkitem.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include "qzcommon.h" @@ -97,7 +97,7 @@ private: QString m_description; QString m_keyword; QIcon m_icon; - QTime m_iconTime; + QElapsedTimer m_iconTime; int m_visitCount; bool m_expanded; bool m_sidebarExpanded; diff --git a/src/lib/bookmarks/bookmarksexport/htmlexporter.cpp b/src/lib/bookmarks/bookmarksexport/htmlexporter.cpp index 92866d621..edd82caa8 100644 --- a/src/lib/bookmarks/bookmarksexport/htmlexporter.cpp +++ b/src/lib/bookmarks/bookmarksexport/htmlexporter.cpp @@ -51,13 +51,13 @@ bool HtmlExporter::exportBookmarks(BookmarkItem* root) QTextStream stream(&file); stream.setCodec("UTF-8"); - stream << "" << endl; - stream << "" << endl; - stream << R"()" << endl; - stream << "Bookmarks" << endl; - stream << "

Bookmarks

" << endl; + stream << "" << Qt::endl; + stream << "" << Qt::endl; + stream << R"()" << Qt::endl; + stream << "Bookmarks" << Qt::endl; + stream << "

Bookmarks

" << Qt::endl; writeBookmark(root, stream, 0); return true; @@ -72,35 +72,35 @@ void HtmlExporter::writeBookmark(BookmarkItem* item, QTextStream &stream, int le switch (item->type()) { case BookmarkItem::Url: - stream << indent << "
urlString() << "\">" << item->title() << "" << endl; + stream << indent << "
urlString() << "\">" << item->title() << "" << Qt::endl; break; case BookmarkItem::Separator: - stream << indent << "
" << endl; + stream << indent << "
" << Qt::endl; break; case BookmarkItem::Folder: { - stream << indent << "

" << item->title() << "

" << endl; - stream << indent << "

" << endl; + stream << indent << "

" << item->title() << "

" << Qt::endl; + stream << indent << "

" << Qt::endl; const auto children = item->children(); for (BookmarkItem* child : children) { writeBookmark(child, stream, level + 1); } - stream << indent << "

" << endl; + stream << indent << "

" << Qt::endl; break; } case BookmarkItem::Root: { - stream << indent << "

" << endl; + stream << indent << "

" << Qt::endl; const auto children = item->children(); for (BookmarkItem* child : children) { writeBookmark(child, stream, level + 1); } - stream << indent << "

" << endl; + stream << indent << "

" << Qt::endl; break; } diff --git a/src/lib/downloads/downloaditem.h b/src/lib/downloads/downloaditem.h index f025330d3..5b53b0c15 100644 --- a/src/lib/downloads/downloaditem.h +++ b/src/lib/downloads/downloaditem.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "qzcommon.h" @@ -52,7 +53,7 @@ public: QString path() const; QString fileName() const; ~DownloadItem() override; - void setDownTimer(const QTime &timer) { m_downTimer = timer; } + void setDownTimer(const QElapsedTimer &timer) { m_downTimer = timer; } void startDownloading(); @@ -87,7 +88,7 @@ private: QWebEngineDownloadItem* m_download; QString m_path; QString m_fileName; - QTime m_downTimer; + QElapsedTimer m_downTimer; QTime m_remTime; QUrl m_downUrl; bool m_openFile; diff --git a/src/lib/downloads/downloadmanager.cpp b/src/lib/downloads/downloadmanager.cpp index bd35f3221..2d57a53cb 100644 --- a/src/lib/downloads/downloadmanager.cpp +++ b/src/lib/downloads/downloadmanager.cpp @@ -260,7 +260,7 @@ void DownloadManager::clearList() void DownloadManager::download(QWebEngineDownloadItem *downloadItem) { - QTime downloadTimer; + QElapsedTimer downloadTimer; downloadTimer.start(); closeDownloadTab(downloadItem); diff --git a/src/lib/history/historymodel.cpp b/src/lib/history/historymodel.cpp index 1aabedfe9..caff6b71a 100644 --- a/src/lib/history/historymodel.cpp +++ b/src/lib/history/historymodel.cpp @@ -22,6 +22,7 @@ #include #include +#include #include static QString dateTimeToString(const QDateTime &dateTime) @@ -336,7 +337,7 @@ void HistoryModel::historyEntryAdded(const HistoryEntry &entry) m_todayItem = new HistoryItem(0); m_todayItem->setStartTimestamp(-1); - m_todayItem->setEndTimestamp(QDateTime(QDate::currentDate()).toMSecsSinceEpoch()); + m_todayItem->setEndTimestamp(QDateTime(QDate::currentDate(), QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch()); m_todayItem->title = tr("Today"); m_rootItem->prependChild(m_todayItem); @@ -466,17 +467,17 @@ void HistoryModel::init() QString itemName; if (timestampDate == today) { - endTimestamp = QDateTime(today).toMSecsSinceEpoch(); + endTimestamp = QDateTime(today, QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch(); itemName = tr("Today"); } else if (timestampDate >= week) { - endTimestamp = QDateTime(week).toMSecsSinceEpoch(); + endTimestamp = QDateTime(week, QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch(); itemName = tr("This Week"); } else if (timestampDate.month() == month.month() && timestampDate.year() == month.year()) { - endTimestamp = QDateTime(month).toMSecsSinceEpoch(); + endTimestamp = QDateTime(month, QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch(); itemName = tr("This Month"); } @@ -484,8 +485,8 @@ void HistoryModel::init() QDate startDate(timestampDate.year(), timestampDate.month(), timestampDate.daysInMonth()); QDate endDate(startDate.year(), startDate.month(), 1); - timestamp = QDateTime(startDate, QTime(23, 59, 59)).toMSecsSinceEpoch(); - endTimestamp = QDateTime(endDate).toMSecsSinceEpoch(); + timestamp = QDateTime(startDate, QTime(23, 59, 59), QTimeZone::systemTimeZone()).toMSecsSinceEpoch(); + endTimestamp = QDateTime(endDate, QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch(); itemName = QString("%1 %2").arg(History::titleCaseLocalizedMonth(timestampDate.month()), QString::number(timestampDate.year())); } diff --git a/src/lib/other/clearprivatedata.cpp b/src/lib/other/clearprivatedata.cpp index 07878f8f8..69608adc9 100644 --- a/src/lib/other/clearprivatedata.cpp +++ b/src/lib/other/clearprivatedata.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -111,13 +112,13 @@ void ClearPrivateData::dialogAccepted() switch (ui->historyLength->currentIndex()) { case 0: //Later Today - end = QDateTime(today).toMSecsSinceEpoch(); + end = QDateTime(today, QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch(); break; case 1: //Week - end = QDateTime(week).toMSecsSinceEpoch(); + end = QDateTime(week, QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch(); break; case 2: //Month - end = QDateTime(month).toMSecsSinceEpoch(); + end = QDateTime(month, QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch(); break; case 3: //All break; diff --git a/src/lib/plugins/qml/api/events/qmlwheelevent.cpp b/src/lib/plugins/qml/api/events/qmlwheelevent.cpp index 0390bf384..ec3389759 100644 --- a/src/lib/plugins/qml/api/events/qmlwheelevent.cpp +++ b/src/lib/plugins/qml/api/events/qmlwheelevent.cpp @@ -45,7 +45,7 @@ QPoint QmlWheelEvent::globalPos() const if (!m_wheelEvent) { return QPoint(-1, -1); } - return m_wheelEvent->globalPos(); + return m_wheelEvent->globalPosition().toPoint(); } QPointF QmlWheelEvent::globalPosF() const @@ -53,7 +53,7 @@ QPointF QmlWheelEvent::globalPosF() const if (!m_wheelEvent) { return QPointF(-1, -1); } - return m_wheelEvent->globalPosF(); + return m_wheelEvent->globalPosition(); } int QmlWheelEvent::globalX() const @@ -61,7 +61,7 @@ int QmlWheelEvent::globalX() const if (!m_wheelEvent) { return -1; } - return m_wheelEvent->globalX(); + return m_wheelEvent->globalPosition().toPoint().x(); } int QmlWheelEvent::globalY() const @@ -69,7 +69,7 @@ int QmlWheelEvent::globalY() const if (!m_wheelEvent) { return -1; } - return m_wheelEvent->globalY(); + return m_wheelEvent->globalPosition().toPoint().x(); } bool QmlWheelEvent::inverted() const @@ -101,7 +101,7 @@ QPoint QmlWheelEvent::pos() const if (!m_wheelEvent) { return QPoint(-1, -1); } - return m_wheelEvent->pos(); + return m_wheelEvent->position().toPoint(); } QPointF QmlWheelEvent::posF() const @@ -109,7 +109,7 @@ QPointF QmlWheelEvent::posF() const if (!m_wheelEvent) { return QPointF(-1, -1); } - return m_wheelEvent->posF(); + return m_wheelEvent->position(); } int QmlWheelEvent::source() const @@ -125,7 +125,7 @@ int QmlWheelEvent::x() const if (!m_wheelEvent) { return -1; } - return m_wheelEvent->x(); + return m_wheelEvent->position().toPoint().x(); } int QmlWheelEvent::y() const @@ -133,7 +133,7 @@ int QmlWheelEvent::y() const if (!m_wheelEvent) { return -1; } - return m_wheelEvent->y(); + return m_wheelEvent->position().toPoint().y(); } void QmlWheelEvent::clear() diff --git a/src/lib/plugins/qml/qmlplugininterface.cpp b/src/lib/plugins/qml/qmlplugininterface.cpp index 5560b0074..f12d6a46e 100644 --- a/src/lib/plugins/qml/qmlplugininterface.cpp +++ b/src/lib/plugins/qml/qmlplugininterface.cpp @@ -386,5 +386,5 @@ void QmlPluginInterface::setAcceptNavigationRequest(const QJSValue &acceptNaviga QQmlListProperty QmlPluginInterface::childItems() { - return QQmlListProperty(this, m_childItems); + return QQmlListProperty(this, &m_childItems); } diff --git a/src/lib/webengine/webpage.cpp b/src/lib/webengine/webpage.cpp index 57b5be114..15f91e53b 100644 --- a/src/lib/webengine/webpage.cpp +++ b/src/lib/webengine/webpage.cpp @@ -64,7 +64,7 @@ QString WebPage::s_lastUploadLocation = QDir::homePath(); QUrl WebPage::s_lastUnsupportedUrl; -QTime WebPage::s_lastUnsupportedUrlTime; +QElapsedTimer WebPage::s_lastUnsupportedUrlTime; QStringList s_supportedSchemes; static const bool kEnableJsOutput = qEnvironmentVariableIsSet("FALKON_ENABLE_JS_OUTPUT"); @@ -365,7 +365,7 @@ void WebPage::desktopServicesOpen(const QUrl &url) // Open same url only once in 2 secs const int sameUrlTimeout = 2 * 1000; - if (s_lastUnsupportedUrl != url || s_lastUnsupportedUrlTime.isNull() || s_lastUnsupportedUrlTime.elapsed() > sameUrlTimeout) { + if ((s_lastUnsupportedUrl != url) || (!s_lastUnsupportedUrlTime.isValid()) || (s_lastUnsupportedUrlTime.elapsed() > sameUrlTimeout)) { s_lastUnsupportedUrl = url; s_lastUnsupportedUrlTime.restart(); QDesktopServices::openUrl(url); diff --git a/src/lib/webengine/webpage.h b/src/lib/webengine/webpage.h index 364de2809..a61e8c41d 100644 --- a/src/lib/webengine/webpage.h +++ b/src/lib/webengine/webpage.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "qzcommon.h" @@ -104,7 +105,7 @@ private: static QString s_lastUploadLocation; static QUrl s_lastUnsupportedUrl; - static QTime s_lastUnsupportedUrlTime; + static QElapsedTimer s_lastUnsupportedUrlTime; DelayedFileWatcher* m_fileWatcher; QEventLoop* m_runningLoop; diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index fced18d54..0d68da7bb 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -1055,9 +1055,9 @@ void WebView::_wheelEvent(QWheelEvent *event) if (event->spontaneous()) { const qreal multiplier = QApplication::wheelScrollLines() / 3.0; if (multiplier != 1.0) { - QWheelEvent e(event->pos(), event->globalPos(), event->pixelDelta(), - event->angleDelta() * multiplier, 0, Qt::Horizontal, event->buttons(), - event->modifiers(), event->phase(), event->source(), event->inverted()); + QWheelEvent e(event->position(), event->globalPosition(), event->pixelDelta(), + event->angleDelta() * multiplier, event->buttons(), + event->modifiers(), event->phase(), event->inverted(), event->source()); QApplication::sendEvent(m_rwhvqt, &e); event->accept(); } diff --git a/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp b/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp index 9633359a9..392156ec7 100644 --- a/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp +++ b/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp @@ -72,7 +72,7 @@ QVector KWalletPasswordBackend::getEntries(const QUrl &url) } // Sort to prefer last updated entries - qSort(list.begin(), list.end()); + std::sort(list.begin(), list.end()); return list; } diff --git a/src/plugins/TabManager/tabmanagerwidget.cpp b/src/plugins/TabManager/tabmanagerwidget.cpp index 76b5b5b1e..18b10423e 100644 --- a/src/plugins/TabManager/tabmanagerwidget.cpp +++ b/src/plugins/TabManager/tabmanagerwidget.cpp @@ -452,7 +452,7 @@ void TabManagerWidget::processActions() m_refreshBlocked = true; - QHash selectedTabs; + QMultiHash selectedTabs; const QString &command = sender()->objectName(); @@ -477,7 +477,7 @@ void TabManagerWidget::processActions() continue; } - selectedTabs.insertMulti(mainWindow, webTab); + selectedTabs.insert(mainWindow, webTab); } winItem->setCheckState(0, Qt::Unchecked); } @@ -518,7 +518,7 @@ void TabManagerWidget::changeGroupType() } } -void TabManagerWidget::closeSelectedTabs(const QHash &tabsHash) +void TabManagerWidget::closeSelectedTabs(const QMultiHash &tabsHash) { if (tabsHash.isEmpty()) { return; @@ -534,7 +534,7 @@ void TabManagerWidget::closeSelectedTabs(const QHash &t } } -static void detachTabsTo(BrowserWindow* targetWindow, const QHash &tabsHash) +static void detachTabsTo(BrowserWindow* targetWindow, const QMultiHash &tabsHash) { const QList &windows = tabsHash.uniqueKeys(); for (BrowserWindow* mainWindow : windows) { @@ -552,7 +552,7 @@ static void detachTabsTo(BrowserWindow* targetWindow, const QHash &tabsHash) +void TabManagerWidget::detachSelectedTabs(const QMultiHash &tabsHash) { if (tabsHash.isEmpty() || (tabsHash.uniqueKeys().size() == 1 && @@ -566,7 +566,7 @@ void TabManagerWidget::detachSelectedTabs(const QHash & detachTabsTo(newWindow, tabsHash); } -bool TabManagerWidget::bookmarkSelectedTabs(const QHash &tabsHash) +bool TabManagerWidget::bookmarkSelectedTabs(const QMultiHash &tabsHash) { auto* dialog = new QDialog(getWindow(), Qt::WindowStaysOnTopHint | Qt::MSWindowsFixedSizeDialogHint); auto* layout = new QBoxLayout(QBoxLayout::TopToBottom, dialog); @@ -608,7 +608,7 @@ bool TabManagerWidget::bookmarkSelectedTabs(const QHash return true; } -void TabManagerWidget::unloadSelectedTabs(const QHash &tabsHash) +void TabManagerWidget::unloadSelectedTabs(const QMultiHash &tabsHash) { if (tabsHash.isEmpty()) { return; @@ -951,7 +951,7 @@ bool TabTreeWidget::dropMimeData(QTreeWidgetItem *parent, int index, const QMime } } else if (!webTab->isPinned()) { - QHash tabsHash; + QMultiHash tabsHash; tabsHash.insert(window, webTab); detachTabsTo(targetWindow, tabsHash); diff --git a/src/plugins/TabManager/tabmanagerwidget.h b/src/plugins/TabManager/tabmanagerwidget.h index 2028afee3..9ded6857f 100644 --- a/src/plugins/TabManager/tabmanagerwidget.h +++ b/src/plugins/TabManager/tabmanagerwidget.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include namespace Ui @@ -68,10 +68,10 @@ public: explicit TabManagerWidget(BrowserWindow* mainClass, QWidget* parent = 0, bool defaultWidget = false); ~TabManagerWidget() override; - void closeSelectedTabs(const QHash &tabsHash); - void detachSelectedTabs(const QHash &tabsHash); - bool bookmarkSelectedTabs(const QHash &tabsHash); - void unloadSelectedTabs(const QHash &tabsHash); + void closeSelectedTabs(const QMultiHash &tabsHash); + void detachSelectedTabs(const QMultiHash &tabsHash); + bool bookmarkSelectedTabs(const QMultiHash &tabsHash); + void unloadSelectedTabs(const QMultiHash &tabsHash); void setGroupType(GroupType type); diff --git a/src/plugins/TabManager/tldextractor/tldextractor.cpp b/src/plugins/TabManager/tldextractor/tldextractor.cpp index 6305608ce..a9b4e52b0 100644 --- a/src/plugins/TabManager/tldextractor/tldextractor.cpp +++ b/src/plugins/TabManager/tldextractor/tldextractor.cpp @@ -321,12 +321,12 @@ bool TLDExtractor::parseData(const QString &dataFile, bool loadPrivateDomains) line = line.left(line.indexOf(QLatin1Char(' '))); if (!line.contains(QLatin1Char('.'))) { - m_tldHash.insertMulti(line, line); + m_tldHash.insert(line, line); } else { QString key = line.mid(line.lastIndexOf(QLatin1Char('.')) + 1); - m_tldHash.insertMulti(key, line); + m_tldHash.insert(key, line); } }