-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathQtThinClient.cpp
53 lines (36 loc) · 1.3 KB
/
QtThinClient.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/************************************************************************/
/// To make this project build successfully, the Qt 4.8.2 should be installed to C:\Qt\
/// The expected location of qmake.exe is: C:\Qt\4.8.2\bin\qmake.exe
/************************************************************************/
#include "stdafx.h"
#include <QtGUI/QApplication>
#include <QtWebkit/QWebView>
#include <QtWebkit/QWebFrame>
#include <QtCOre/QFileInfo>
#include "QJsCppBridge.h"
int _tmain(int argc, char* argv[])
{
// Initialize Qt.
QApplication app( argc, argv );
//QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
QWebView mWebView;
{
mWebView.setGeometry(50,100,400,200);
QPalette palette = mWebView.palette();
palette.setBrush(QPalette::Base, Qt::transparent);
mWebView.page()->setPalette(palette);
mWebView.setAttribute(Qt::WA_OpaquePaintEvent, false);
}
QWebFrame *frame = mWebView.page()->mainFrame();
QJsCppBridge bridge(frame);
// Load html page
{
QString path = QFileInfo(QCoreApplication::applicationFilePath()).absolutePath();
QString htmlPage = "file:///" + path + "/Html/index1.html";
mWebView.load(QUrl(htmlPage));
}
mWebView.show();
// Run the message loop.
app.exec();
return 0;
}