M
M
Maxim Ivanov2016-04-24 00:45:34
Qt
Maxim Ivanov, 2016-04-24 00:45:34

How to compile Qt WebEngine?

Project content
.pro file

TEMPLATE = app
QT += webengine
QT += qml quick
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc
CONFIG+=release

main.cpp
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtWebEngine>

int main(int argc, char **argv) {
    QGuiApplication app(argc, argv);
    QtWebEngine::initialize();

    QQmlApplicationEngine appEngine;
    appEngine.load(QUrl("qrc:/main.qml"));

    return app.exec();
}

main.qml
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtWebEngine 1.1

ApplicationWindow {
    width: 680
    height: 520
    visible: true
    title: qsTr("Hello World")
    WebEngineView {
        visible: true
        id: webview
        url: "http://www.qt.io"
        anchors.fill: parent
    }
}

When we press Ctrl + R (build) in Qt, the application is displayed as it should and shows the site.
120630d61bea4ffdbc8b948fca25b1c5.png
But when we open the directory where the project is going, that is, the place where the binary was compiled, we open it, and the result is an empty window, why and how to fix it?
cef6558024224ea18248ec4ce94f140d.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel K, 2016-04-24
@splincodewd

pavelk.ru/qtwebengine-zavisimosti-ili-ne-otobrazha...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question