基于linux + qt+ webenginewidgets 应用程序,多平台

作者: shaoliang 2020-04-09 08:47   访问数:789

                                                         

#-------------------------------------------------
#
# Project created by QtCreator 2020-04-09T08:09:48
#
#-------------------------------------------------

QT       += core gui
QT       += core gui webenginewidgets


greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = untitled4
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


SOURCES += \
        main.cpp \
        widget.cpp

HEADERS += \
        widget.h

FORMS += \
        widget.ui

QMAKE_LFLAGS += -no-pie
QT       += core gui webenginewidgets
#ifndef WIDGET_H
#define WIDGET_H

#include 《QWidget》
#include 《QWebEngineView》


//#include namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

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);

}

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

void Widget::on_pushButton_clicked()
{

//    view->resize(this->size());

    view->load(QUrl(QStringLiteral("https://51dr.top")));
    view->showMaximized(); 
}

void Widget::on_pushButton_2_clicked()
{

    view->load(QUrl(QStringLiteral("https://51dr.top/admin/user/")));
    view->showMaximized();
}







build-untitled4-Desktop_Qt_5_9_5_GCC_64bit-Debug.zip


untitled4 代码.zip


鲁ICP备19029146号-1 管理
CopyRight@51dr.top 页面打开时间 0.0327 秒.