Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWebView local html problem
Qt 6.11 is out! See what's new in the release blog

QWebView local html problem

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    hi,
    @void mainWind::ajouterOngle()
    {
    QWidget *ongle = new QWidget;
    ui->tabWidget->insertTab(ui->tabWidget->indexOf(ui->nouveauongle),ongle,"");
    ui->tabWidget->setCurrentWidget(ongle);
    QWebView *pageweb =new QWebView;
    pageweb->load(QUrl("pagevide.html"));
    QVBoxLayout *layout=new QVBoxLayout;
    layout->addWidget(pageweb);
    ongle->setLayout(layout);
    changeOngle(ui->tabWidget->indexOf(ongle));
    }@

    when I compile all goes well, but in the program as I call this method “microsoft visual c + + runtime library” error
    I try to solve the problem and I noticed that Error is in line 7 load (local html file) when I delet it there is no problem and all goes well so how do I load (local html file )

    I intend that this problem is because of “http://” I didn’t put it in QUrl because it is a local file

    and I notice that other browser makes “file :/ / / html / pagevide.html” in url so I change all goes well but I noticed that the browser does not load the file because nothing is wrote in Urlbar and the page didn’t display (because I put an image in the html file) and the same problem when I write
    @ pageActuelle () -> load (QUrl :: fromLocalFile ("html / pagevide.html"))@

    Note: I have put the html file in the program directory

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      please give me a answer to this Forum :’(

      1 Reply Last reply
      0
      • M Offline
        M Offline
        monsingh
        wrote on last edited by
        #3

        Hi

        you fail to call show() function.

        give like this.
        pageweb.show()

        without give show function , nothing will show. it call default function of hide()

        1 Reply Last reply
        0
        • M Offline
          M Offline
          monsingh
          wrote on last edited by
          #4

          Hi

          why you are using QVBoxLayout?

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            i use th layout because I had the idea that will be better to organize my widget
            my problem is not with pageweb.show() because if i change pagevide.html with http://google.com the page google is displayed

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved