QTweb 程序

QT       += core gui webenginewidgets

---------------------------------------

#ifndef WIDGET_H
#define WIDGET_H

#include
#include

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private:
    Ui::Widget *ui;

    QWebEngineView *view;

};
#endif // WIDGET_H

---------------------------------------

#include "widget.h"
#include "ui_widget.h"

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

    view = new QWebEngineView(this);
    view->load(QUrl("http://www.baidu.com/"));

    ui->verticalLayout->addWidget(view);
}

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

你可能感兴趣的:(QT,qt)