Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) QWebViewExample1

 

QtQt CreatorLubuntu

 

QWebView example 1 is a QWebView example.

 

 

This example might cause following errors:

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./CppQWebViewExample1/CppQWebViewExample1.pro

 

QT += core gui

cross_compile {
  message(Crosscompiling)
}

greaterThan(QT_MAJOR_VERSION, 4) {
  message(Qt5)
  QT += widgets
  !cross_compile {
    message(Not crosscompiling)
    QT += webkitwidgets
  }
} else {
  message(Qt4)
  QT += webkit
}

TEMPLATE = app

SOURCES += \
  main.cpp\
  cppqwebviewexample1dialog.cpp

HEADERS  += cppqwebviewexample1dialog.h

FORMS    += cppqwebviewexample1dialog.ui

 

 

 

 

 

./CppQWebViewExample1/cppqwebviewexample1dialog.h

 

#ifndef CPPQWEBVIEWEXAMPLE1DIALOG_H
#define CPPQWEBVIEWEXAMPLE1DIALOG_H

#include <QDialog>

namespace Ui {
  class CppQWebViewExample1Dialog;
}

class CppQWebViewExample1Dialog : public QDialog
{
  Q_OBJECT
  
public:
  explicit CppQWebViewExample1Dialog(QWidget *parent = 0);
  ~CppQWebViewExample1Dialog();
  
private:
  Ui::CppQWebViewExample1Dialog *ui;
};

#endif // CPPQWEBVIEWEXAMPLE1DIALOG_H

 

 

 

 

 

./CppQWebViewExample1/cppqwebviewexample1dialog.cpp

 

#include "cppqwebviewexample1dialog.h"
#include "ui_cppqwebviewexample1dialog.h"

CppQWebViewExample1Dialog::CppQWebViewExample1Dialog(QWidget *parent) :
  QDialog(parent),
  ui(new Ui::CppQWebViewExample1Dialog)
{
  ui->setupUi(this);

  ui->webView->setHtml(
    "<h1>Hello World</h1>"
    "<h2>Hello World</h2>"
    "<h3>Hello World</h3>"
    "<p>Hello World</p>"
    "<ul><li>Hello World</li></ul>"
  );
}

CppQWebViewExample1Dialog::~CppQWebViewExample1Dialog()
{
  delete ui;
}

 

 

 

 

 

./CppQWebViewExample1/main.cpp

 

#include <QApplication>
#include "cppqwebviewexample1dialog.h"

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  CppQWebViewExample1Dialog w;
  w.show();  
  return a.exec();
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml