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. QWebPage crash

QWebPage crash

Scheduled Pinned Locked Moved General and Desktop
33 Posts 2 Posters 9.9k 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.
  • G Offline
    G Offline
    Giperboloid
    wrote on last edited by
    #1

    I have such piece of code:
    @
    MainWindow::MainWindow(QWidget *parent) :
    yandexPage(new QWebPage()), metaPage(new QWebPage()),
    QMainWindow(parent), ui(new Ui::MainWindow)
    {
    yandexPage->mainFrame()->load(QUrl("http://www.yandex.ua"));
    metaPage->mainFrame()->load(QUrl("https://meta.ua"));

    connect(yandexPage, SIGNAL(loadFinished(bool)), this, SLOT(parseYandexWebPage()));
    connect(metaPage,SIGNAL(loadFinished(bool)), this, SLOT(parseMetaWebPage()));
    

    void MainWindow::parseMetaWebPage()
    {
    QWebPage webPage;
    webPage.mainFrame()->setHtml(metaPage->mainFrame()->toHtml());
    ...
    }@

    Can someone explain the cause of crash in the 14 line?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What does a run through the debugger say ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Giperboloid
        wrote on last edited by
        #3

        Hi, nothing) Just a crash during execution.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Giperboloid
          wrote on last edited by
          #4

          I don't know how but after some hours and without making any changes (!) my project began to work. Very strange. One problem that left is that the window icon doesn't want to show.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            How are you setting it ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • G Offline
              G Offline
              Giperboloid
              wrote on last edited by
              #6

              I did it in two ways: in window property "Window icon" I set my image and in the constructor of the form I had written:
              @this->setWindowIcon(QIcon(QPixmap(":valuta")));@
              P.S. This image is already in resource file.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Check that the pixmap is valid. You might have an invalid path e.g. missing the prefix to the image file

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  Giperboloid
                  wrote on last edited by
                  #8

                  I have found this post https://qt-project.org/forums/viewthread/32268 and understood that I used '' instead of '/'. Code that must set form icon works but if I set this icon using form properties nothing changes.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    Giperboloid
                    wrote on last edited by
                    #9

                    And my code works only if I use absolute path to the file. My resouce file doesn't work.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Then you might be using a wrong path for the resource. How does the qrc file look like ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        Giperboloid
                        wrote on last edited by
                        #11

                        @<RCC>
                        <qresource prefix="/">
                        <file>valuta.png</file>
                        </qresource>
                        </RCC>
                        @

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @this->setWindowIcon(QIcon(QPixmap(":/valuta.png")));@

                          You were missing the extension

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            Giperboloid
                            wrote on last edited by
                            #13

                            Code works even without extension ;)
                            But if I set icon in form design mode the setting is not working.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              I'm not sure I'm following you there. When setting the icon in designer it doesn't work ? How do you set it ? Are you modifying it ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                Giperboloid
                                wrote on last edited by
                                #15

                                Yes, when I set the window's icon in creator it doesn't work. I found property "windowIcon" in the right side and chose my icon in .png extension.

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  Okay, but it doesn't work when running from Qt Creator ?

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • G Offline
                                    G Offline
                                    Giperboloid
                                    wrote on last edited by
                                    #17

                                    Yes, after setting icon shows normal in creator, but during execution programm has standard icon.

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      That I understood, but my question is: are you running the application through Qt Creator ? Or from the explorer ?

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      0
                                      • G Offline
                                        G Offline
                                        Giperboloid
                                        wrote on last edited by
                                        #19

                                        I'm running application throught Qt Creator.

                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          What's the path to the icon ?

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          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