QtLabel_Html |
Start a New Project
|
1. Choosing a template :QtWidegets in 5.3 and QtGui in
5.1
Add a push button |
Rename as "webpage1" and right click on this button, then select Go
to Slot to bind an event.
Now add these two header files as shown the screenshot below Edit mainwindow.ccp #include "mainwindow.h" #include "ui_mainwindow.h" #include <QDesktopServices> #include <QUrl> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this); }
MainWindow::~MainWindow() {
delete ui; }
void MainWindow::on_pushButton_clicked() {
QString hlink = "http://frontinterface.com"; QDesktopServices::openUrl(QUrl(hlink)); }
|
This open a handle to open a default internet browser
|