Esempio n. 1
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWebView* view;
    view = new QWebView();
    ViewLoader loader;

    //connect view signals with splashscreen
    QObject::connect(view, SIGNAL(loadStarted()),
                      &loader, SLOT(on_loadStarted()));
    QObject::connect(view, SIGNAL(loadProgress(int)),
                      &loader, SLOT(on_loadProgress(int)));
    QObject::connect(view, SIGNAL(loadFinished(bool)),
                      &loader, SLOT(on_loadFinished(bool)));

    Sensor *sensor = new Sensor(view);
    qDebug() << QDir::currentPath();
    QFileInfo myFileInfo("html/index.html");
    QUrl url = QUrl( "file://" + myFileInfo.absoluteFilePath());
    qDebug() << url;
    view->load(url);
    view->showFullScreen();
    return app.exec();
}
Esempio n. 2
0
MyWebView::MyWebView(QWidget *parent) : QWebView(parent)
{
	m_strCurrentElemId = "";
	installEventFilter(this);
	setAcceptDrops(true);
	QObject::connect( this, SIGNAL(loadStarted())     , this, SLOT(on_loadStarted())      );
	QObject::connect( this, SIGNAL(loadFinished(bool)), this, SLOT(on_loadFinished(bool)) );
	// set qt style to webview
	setStyleSheet("background-color: lightgray;");
	// set css style for highlighting element
	QString     strStyle = "border-style  : solid    !important; "
						   "border-width  : 2px      !important; "
						   "border-color  : #f0f090  !important; ";
	SetHighlightStyleClass(g_strHighlightClassName, strStyle);
}