#include <QApplication>
#include <QTextBrowser>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
#include <QUrl>
int main(int argc, char **argv){
layout->addWidget(frwd);
layout->addWidget(bck);
layout->addWidget(&brws);
w.setLayout(layout);
QObject::connect(frwd,
SIGNAL(clicked
()),
&brws,
SLOT(forward
()));
QObject::connect(bck,
SIGNAL(clicked
()),
&brws,
SLOT(backward
()));
QObject::connect(&brws,
SIGNAL(forwardAvailable
(bool)), frwd,
SLOT(setEnabled
(bool)));
QObject::connect(&brws,
SIGNAL(backwardAvailable
(bool)), bck,
SLOT(setEnabled
(bool)));
brws.
setSource(QUrl::fromLocalFile("file1.html"));
w.show();
return app.exec();
}
#include <QApplication>
#include <QTextBrowser>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
#include <QUrl>
int main(int argc, char **argv){
QApplication app(argc, argv);
QWidget w;
QVBoxLayout *layout = new QVBoxLayout();
QPushButton *frwd = new QPushButton("Forward");
QPushButton *bck = new QPushButton("Back");
layout->addWidget(frwd);
layout->addWidget(bck);
QTextBrowser brws;
layout->addWidget(&brws);
w.setLayout(layout);
QObject::connect(frwd, SIGNAL(clicked()), &brws, SLOT(forward()));
QObject::connect(bck, SIGNAL(clicked()), &brws, SLOT(backward()));
QObject::connect(&brws, SIGNAL(forwardAvailable(bool)), frwd, SLOT(setEnabled(bool)));
QObject::connect(&brws, SIGNAL(backwardAvailable(bool)), bck, SLOT(setEnabled(bool)));
brws.setSource(QUrl::fromLocalFile("file1.html"));
w.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks