Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QWebView don't display local html



  • @mainWind::mainWind(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::mainWind)
    {
    ui->setupUi(this);
    QWebView *pageWeb=new QWebView();
    pageWeb->load(QUrl("html/pagevide.htm"));
    ui->tabWidget->insertTab(ui->tabWidget->indexOf(ui->nouveauongle),pageWeb,"a");
    ui->toolBar_2->insertWidget(ui->action_R_tablire,ui->champAdresse);
    setCentralWidget(ui->tabWidget);
    ui->statusbar->addPermanentWidget(ui->progressBar);
    ui->statusbar->setVisible(false);
    connect(ui->actionNouveaux_onglet,SIGNAL(triggered()),this,SLOT(ajouterOngle()));
    connect(ui->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(changeOngle(int)));

    }
    @

    the problem is that qwebview don't display the html (there is a photo in the html)



  • The current working directory of the program is probably not where you think it is and therefore the relative path to the HTML file is not resolving to where you think it is.

    You should also look at QUrl::fromLocalFile()


Log in to reply