mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 12:46:35 +01:00
Qt6 - Fix thumbnailer
Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
b0541447c5
commit
70bf79e371
18
src/lib/data/data/thumbnailer-qt5.qml
Normal file
18
src/lib/data/data/thumbnailer-qt5.qml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import QtQuick 2.2
|
||||||
|
import QtWebEngine 1.0
|
||||||
|
|
||||||
|
WebEngineView {
|
||||||
|
id: view
|
||||||
|
width: 1280
|
||||||
|
height: 720
|
||||||
|
|
||||||
|
onLoadingChanged: {
|
||||||
|
if (loadRequest.status == WebEngineView.LoadStartedStatus)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var ok = loadRequest.status == WebEngineView.LoadSucceededStatus;
|
||||||
|
view.runJavaScript(thumbnailer.afterLoadScript(), function() {
|
||||||
|
thumbnailer.createThumbnail(ok);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -6,11 +6,11 @@ WebEngineView {
|
|||||||
width: 1280
|
width: 1280
|
||||||
height: 720
|
height: 720
|
||||||
|
|
||||||
onLoadingChanged: {
|
onLoadingChanged: function(loadingInfo) {
|
||||||
if (loadRequest.status == WebEngineView.LoadStartedStatus)
|
if (loadingInfo.status == WebEngineView.LoadStartedStatus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var ok = loadRequest.status == WebEngineView.LoadSucceededStatus;
|
var ok = loadingInfo.status == WebEngineView.LoadSucceededStatus;
|
||||||
view.runJavaScript(thumbnailer.afterLoadScript(), function() {
|
view.runJavaScript(thumbnailer.afterLoadScript(), function() {
|
||||||
thumbnailer.createThumbnail(ok);
|
thumbnailer.createThumbnail(ok);
|
||||||
});
|
});
|
||||||
|
@ -33,7 +33,11 @@ PageThumbnailer::PageThumbnailer(QObject* parent)
|
|||||||
, m_loadTitle(false)
|
, m_loadTitle(false)
|
||||||
{
|
{
|
||||||
m_view->setAttribute(Qt::WA_DontShowOnScreen);
|
m_view->setAttribute(Qt::WA_DontShowOnScreen);
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
m_view->setSource(QUrl(QSL("qrc:data/thumbnailer-qt5.qml")));
|
||||||
|
#else
|
||||||
m_view->setSource(QUrl(QSL("qrc:data/thumbnailer.qml")));
|
m_view->setSource(QUrl(QSL("qrc:data/thumbnailer.qml")));
|
||||||
|
#endif
|
||||||
m_view->rootContext()->setContextProperty(QSL("thumbnailer"), this);
|
m_view->rootContext()->setContextProperty(QSL("thumbnailer"), this);
|
||||||
m_view->show();
|
m_view->show();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user