QWebPage分段错误 [英] QWebPage segmentation fault

查看:136
本文介绍了QWebPage分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我实例化QWebPage对象时,我遇到了分段错误,我不明白为什么!

When I instantiate an QWebPage object I have a segmentation fault, I don't understand why !

我在main.cpp中调用我的对象

I call my object in main.cpp

webview *nav = new webview();

我的webview.h:

my webview.h :

#ifndef WEBVIEW_H
#define WEBVIEW_H

#include <QRegularExpression>
#include <QWebPage>
#include <QWebFrame>
#include <QPrinter>
#include <QDebug>

#include "arguments.h"

class webview
{
public:
    webview();
    ~webview();
    bool load(Arguments *args);
    QWebFrame* getFrame() { return frame;}

private:
    QWebPage *page;
    QWebFrame *frame;
};

和我的webview.cpp

and my webview.cpp

#include "webview.h"
webview::webview()
{

    page = new QWebPage();
}
[...]
webview::~webview()
{
delete page;
}

分段错误错误出现在webview构造函数中:

An Segmentation fault error appear in webview constructor :

page = new QWebPage();

真的我不明白为什么

您可以在此处下载该项目: http://www.partage -facile.com/Y8NROQ09HG/htmltopdf.tar.gz.html

you can download the project here : http://www.partage-facile.com/Y8NROQ09HG/htmltopdf.tar.gz.html

推荐答案

您不能将QtWebKit与QCoreApplication一起使用,请将所有QCoreApplication更改为QApplication.

You cannot use QtWebKit with QCoreApplication, change all QCoreApplication to QApplication.

这篇关于QWebPage分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆