Skip to content

Instantly share code, notes, and snippets.

@R4md4c
Created January 2, 2012 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save R4md4c/1550329 to your computer and use it in GitHub Desktop.
Save R4md4c/1550329 to your computer and use it in GitHub Desktop.
MainWindow of the program
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QUrl>
#include <QDesktopServices>
#include <QMessageBox>
MainWindow::MainWindow(const QUrl& urlToOpen, QWidget *parent) :
QWebView(parent)
{
load(urlToOpen);
QWebSettings::setIconDatabasePath(QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation));
connect(this, SIGNAL(titleChanged(QString)), SLOT(onTitleChanged(QString)));
connect(this, SIGNAL(iconChanged()), SLOT(onIconChanged()));
connect(this, SIGNAL(loadFinished(bool)), SLOT(onLoadPageFinished(bool)));
}
void MainWindow::onTitleChanged(const QString& title)
{
setWindowTitle(title);
}
void MainWindow::onIconChanged()
{
setWindowIcon(icon());
}
void MainWindow::onLoadPageFinished(bool isLoadFinished)
{
setWindowIcon(icon());
if(isLoadFinished)
QMessageBox::information(this, "Load Finished", "Page is Loaded Successfully", QMessageBox::Ok);
else
QMessageBox::information(this, "Load Finished", "Page Loading Timeout", QMessageBox::Ok);
}
MainWindow::~MainWindow()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment