QT QML WebView onPause Android

时间:2016-10-27 12:53:27

标签: android qt webview qml

我在QT中使用QML创建WebView,并在暂停一些操作后(D WebView:onPause)。我如何检测它并恢复WebView?

的main.cpp

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    QtWebView::initialize();
    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    return app.exec();
}

main.qml

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtWebView 1.1
import QtQuick.Layouts 1.0

ApplicationWindow {
    id: app
    visible: true

    WebView {
        id: webView
        anchors.fill: parent
        visible: true
        url: "http://mail.ru"
    }
}

清单

...
android:launchMode="singleInstance"
....
<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.HOME" />
    <category android:name="android.intent.category.LAUNCHER" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

0 个答案:

没有答案