#include <QtGui>
#include <QtWebKit>
#include "browser.h"
#include <QIcon>
browser::browser()
{
view = new QWebView(this);
view->load(QUrl("
http://www.google.ru/"));
setCentralWidget(view);
fileToolBar = addToolBar(tr("File"));
adress = new QLineEdit(fileToolBar);
fileToolBar->addWidget(adress);
backward = new QPushButton(tr(""), fileToolBar);
fileToolBar->addWidget(backward);
forward = new QPushButton(tr(""), fileToolBar);
fileToolBar->addWidget(forward);
reload = new QPushButton(tr(""), fileToolBar);
fileToolBar->addWidget(reload);
stop = new QPushButton(tr(""), fileToolBar);
fileToolBar->addWidget(stop);
progress = new QProgressBar(fileToolBar);
QIcon icon;
reload->setIcon(QIcon("relo.png"));
backward->setIcon(QIcon("undo.png"));
forward->setIcon(QIcon("forw.png"));
stop->setIcon(QIcon("stop.png"));
fileToolBar->addWidget(progress);
connect(adress,SIGNAL(returnPressed()),this,SLOT(load()));
connect(backward,SIGNAL(clicked()),view,SLOT(backward())); connect(forward,SIGNAL(clicked()),view,SLOT(forward()));
connect(reload,SIGNAL(clicked()),view,SLOT(reload()));
connect(stop,SIGNAL(clicked()),view,SLOT(stop()));
connect(view,SIGNAL(loadProgressChanged(int)),progress,SLOT(setValue(int)));}
void browser::load()
{
QString name("http://" + adress->text());
view->load(QUrl(name));
}
В чем же здесь проблема
main.cpp#include <QApplication>
#include "browser.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
browser wnd;
wnd.setWindowTitle("iBrows");
wnd.show();
return app.exec();
}
browsr.h#ifndef BROWSER_H
#define BROWSER_H
#include <QMainWindow>
class QWebView;
class QLineEdit;
class QPushButton;
class QProgressBar;
class QIcon;
class browser : public QMainWindow
{
Q_OBJECT
public:
browser();
public slots:
void load();
private:
QWebView *view;
QToolBar *fileToolBar;
QLineEdit *adress;
QPushButton *backward, *forward, *reload, *stop;
QProgressBar *progress;
};
#endif