forked from quickshell/quickshell
core/intercept: do not intercept non qml files
Avoids forcing Images to lazy load which causes unexpected flashes.
This commit is contained in:
parent
518977932d
commit
9f38908bdf
4 changed files with 23 additions and 0 deletions
|
@ -9,11 +9,26 @@
|
|||
#include <qnetworkaccessmanager.h>
|
||||
#include <qnetworkrequest.h>
|
||||
#include <qobject.h>
|
||||
#include <qqmlabstracturlinterceptor.h>
|
||||
#include <qstring.h>
|
||||
#include <qtypes.h>
|
||||
#include <qurl.h>
|
||||
|
||||
Q_LOGGING_CATEGORY(logQsIntercept, "quickshell.interceptor", QtWarningMsg);
|
||||
|
||||
QUrl QsUrlInterceptor::intercept(const QUrl& url, QQmlAbstractUrlInterceptor::DataType type) {
|
||||
// Some types such as Image take into account where they are loading from, and force
|
||||
// asynchronous loading over a network. qsintercept is considered to be over a network.
|
||||
if (type == QQmlAbstractUrlInterceptor::DataType::UrlString && url.scheme() == "qsintercept") {
|
||||
auto newUrl = url;
|
||||
newUrl.setScheme("file");
|
||||
qCDebug(logQsIntercept) << "Rewrote intercept" << url << "to" << newUrl;
|
||||
return newUrl;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
QsInterceptDataReply::QsInterceptDataReply(const QString& qmldir, QObject* parent)
|
||||
: QNetworkReply(parent)
|
||||
, content(qmldir.toUtf8()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue