0
環境
- Mac OSX上的優勝美地
- QT5
- 3個文件
- 的main.cpp
- main.qml
- webengine.pro
的main.cpp
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
#include <QtWebEngine/qtwebengineglobal.h>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtWebEngine::initialize();
QQmlApplicationEngine engine;
engine.load(QUrl("main.qml"));
return app.exec();
}
main.qml
import QtQuick 2.0
import QtWebEngine 1.0
import QtQuick.Controls 1.3
import QtQuick.Window 2.0
ApplicationWindow {
title: qsTr("Test")
width: 1200
height: 800
visible: true
WebEngineView {
width: Screen.width
height: Screen.height
anchors.fill: parent
url: 'http://duckduckgo.com'
}
}
webengine.pro
TARGET = browser
TEMPLATE = app
SOURCES = main.cpp
QT += qml quick webengine
運行QML - PASS
/usr/local/Cellar/qt5/5.4.0/bin/qmlscene main.qml
編譯和運行Mac應用程序 - FAIL
qmake
make
然後我點擊browser.app
,應用程序啓動,但沒有窗口中打開。
任何暗示我做錯了什麼?
woohoo那樣高效!謝了哥們。 – zabumba