-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
42 lines (36 loc) · 877 Bytes
/
mainwindow.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
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
ui->webView->load(QUrl(ui->urlEdit->text()));
}
void MainWindow::on_urlEdit_returnPressed()
{
on_pushButton_clicked();
}
void MainWindow::on_webView_loadStarted()
{
ui->statusBar->showMessage("Loading URL");
}
void MainWindow::on_webView_loadFinished(bool arg1)
{
if (arg1)
{
ui->statusBar->showMessage("Load success");
ui->urlEdit->setText(ui->webView->url().toString());
}
else{
ui->statusBar->showMessage("showing google results");
ui->webView->load(QUrl("http://www.google.com.sg/search?sourceid=chrome&ie=UTF-8&q="+ui->urlEdit->text()));
}
}