QtLabel_Html
Start a New Project
  1. <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
  2. <TITLE>301 Moved</TITLE></HEAD><BODY>
  3. <H1>301 Moved</H1>
  4. The document has moved
  5. <A HREF="http://www.google.com/">here</A>.
  6. </BODY></HTML>

 

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