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. Looks like the SIGNAL loadFinished(bool) is not emitted anymore with Qt 6.8.1
Forum Updated to NodeBB v4.3 + New Features

Looks like the SIGNAL loadFinished(bool) is not emitted anymore with Qt 6.8.1

Scheduled Pinned Locked Moved Solved General and Desktop
67 Posts 5 Posters 10.5k Views
  • 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.
  • JonBJ JonB

    @Volker75
    I believe this is because you have put the class definition with Q_OBJECT directly into a .cpp file. Then moc does not get run on it. You be best/simplest moving the whole class MyWebEngineView definition to its own .h file, including that, and doing a clean rebuild.

    Actually, I don't see why what you have requires Q_OBJECT. Try commenting that line and (important) do a really clean rebuild?

    But then connect(view, &MyWebEngineView::loadFinished probably won't work.... Don't know then whether &QWebEngineView::loadFinished would work here. You may have to do first paragraph above, move to .h file.

    You might wait for @ChrisW67 to get back if he has anything to say, I don't know what effort this is worth for whatever it is trying to prove.

    C Offline
    C Offline
    ChrisW67
    wrote on last edited by
    #52

    @JonB said in Looks like the SIGNAL loadFinished(bool) is not emitted anymore with Qt 6.8.1:

    You might wait for @ChrisW67 to get back if he has anything to say, I don't know what effort this is worth for whatever it is trying to prove.

    You are correct, it probably does not require Q_OBJECT. It's just habit for me to put it there and I was typing without the benefit of a Qt environment. I also missed the connect() referring to the wrong class as the target.

    It's just trying to make construct/destruct of the object overt and identify the objects (hence printing this). This is an aid to identifying if you have accidentally created a masking variable and to allow ensuring that everything is operating on the same object. This could also be done with debugger breakpoints and understanding.

    1 Reply Last reply
    1
    • V Offline
      V Offline
      Volker75
      wrote on last edited by Volker75
      #53
      This post is deleted!
      1 Reply Last reply
      0
      • V Offline
        V Offline
        Volker75
        wrote on last edited by Volker75
        #54

        I was able to make a minimum example.
        With Qt 6.7.2 it is working fine.
        With Qt 6.8.1 is doesn't work.
        Tested with Kubuntu 24.04.
        http://www.scryer.de/MinBUG.zip

        Can maybe anyone have a look?
        Thank you so much!

        1 Reply Last reply
        0
        • hskoglundH Online
          hskoglundH Online
          hskoglund
          wrote on last edited by
          #55

          Hi, I tested on Ubuntu 24.04.1 using Qt 6.8.1 in Release mode with gcc version 13.3.0 and your app is working fine for me.
          However, nothing really happened, the QWebEngineEiew just sits there waiting for an initial url to start.
          So i added one line to your timetableprintform.cpp:

          ...
          viewPreview2 = new QWebEngineView(this); //notVisible. But must stay alive for printing.
          viewPreview2->setHtml("");  // <--- I added this line
          viewPreview2->hide();
          ...
          

          and then I got this qQebug output:
          printPreviewLoadStarted
          printPreviewLoadProgress
          0
          The cached device pixel ratio value was stale on window update. Please file a QTBUG which explains how to reproduce.
          The cached device pixel ratio value was stale on window update. Please file a QTBUG which explains how to reproduce.
          printPreviewLoadProgress
          70
          printPreviewLoadProgress
          100
          setView start
          setView end
          printPreview
          printDocument
          printFinished
          The cached device pixel ratio value was stale on window update. Please file a QTBUG which explains how to reproduce.
          The cached device pixel ratio value was stale on window update. Please file a QTBUG which explains how to reproduce.
          The cached device pixel ratio value was stale on window update. Please file a QTBUG which explains how to reproduce.

          So it seems to be working fine, no crash.
          P.S. Don't worry about those QTBUG message, they always appear for me since maybe 2023.

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Volker75
            wrote on last edited by
            #56

            That line is already included.
            See timetableprintform.cpp line 42.
            And it is only working with Qt 6.7.2. Not with Qt 6.8.1.

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Volker75
              wrote on last edited by
              #57

              It's a bit funny that it work in that line you added.
              But i can't write it there, since in the real application is a big dialog where you can select of different settings and timetables.
              So I can't call it from there.
              I must call it from line 42 and there it is not working anymore.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                Volker75
                wrote on last edited by Volker75
                #58

                So the bug is, that this line doesn't work anymore. But why? I need a connect. I can't call it in the constructor like you done it.

                connect(pbPrintPreviewFull, SIGNAL(clicked()), this, SLOT(printPre
                

                You must of course press on preview button!

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  Volker75
                  wrote on last edited by Volker75
                  #59

                  BTW: I don't get the "The cached device pixel ratio value was stale on window update. Please file a QTBUG which explains how to reproduce." information. Are you using Windows, Linux or MacOS?
                  I am currently trying Linux only and Linux doesn't work anymore :-(

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    Volker75
                    wrote on last edited by
                    #60

                    Ah... Sorry. Reading your mail once again.
                    Yes, then also the preview button is working. Strange. But the solution doesn't work, since there is a big white preview first and i can't hide it. And after printpreview at should also close, but it stays in the window. So that is not useable. It should work as with Qt 6.7.2.

                    1 Reply Last reply
                    0
                    • hskoglundH Online
                      hskoglundH Online
                      hskoglund
                      wrote on last edited by
                      #61

                      Hi, the reason the behavior differs between Qt 6.7.2 and Qt 6.8.1 is probably because you're creating the QWebEngineView with your QDialog derived TimetablePrintForm, i.e. not a QWdiget.

                      Easiest solution is just to omit any parent, like this:

                      ,,,
                      viewPreview2 = new QWebEngineView(); //notVisible. But must stay alive for printing.
                      viewPreview2->hide();
                      ...
                      

                      It was probably just good luck that allowed a QDialog flavoed parent to work anyway in 6.7.2 but in 6.8.1 you run out of it :-)

                      1 Reply Last reply
                      1
                      • V Offline
                        V Offline
                        Volker75
                        wrote on last edited by
                        #62

                        I fear I don't understand it 100%, but it is working now!
                        Thank you so much!
                        You have earned my announce reward. Please tell me your PayPal (email) or IBAN here or write me a private message and I will sent you the money..
                        Can you also tell if I need to care about deleting it now myself?
                        So do I need to write somewhere "delete viewPreview2" myself now or does the garbage collector already cares about it?

                        1 Reply Last reply
                        0
                        • hskoglundH Online
                          hskoglundH Online
                          hskoglund
                          wrote on last edited by
                          #63

                          Re. the delete: easiest is to do that in TimetablePrintForm's destructor:

                          ...
                          TimetablePrintForm::~TimetablePrintForm(){
                              delete viewPreview2;
                          }
                          ...
                          

                          (in C++ you have to take out the garbage yourself, no GC available)

                          1 Reply Last reply
                          1
                          • V Volker75 has marked this topic as solved on
                          • V Offline
                            V Offline
                            Volker75
                            wrote on last edited by
                            #64

                            Thank you! I guess the other bug that I wrote some time ago and wrote a link here is because of the same bug. I well mark the other topic from me as solved as soon as I am able the check that also. Thank you!

                            1 Reply Last reply
                            0
                            • V Offline
                              V Offline
                              Volker75
                              wrote on last edited by Volker75
                              #65

                              Last question:
                              I saw in the documentation, that QWebEngineView() has also a close().
                              Should I close() before delete? (Or only close() and not delete, but I guess that is wrong)

                              1 Reply Last reply
                              0
                              • hskoglundH Online
                                hskoglundH Online
                                hskoglund
                                wrote on last edited by
                                #66

                                Since your QWebEngineView is hidden anyway (which is essentially what close() does), I don't think a close() is needed, i.e. the delete will suffice.

                                1 Reply Last reply
                                0
                                • V Offline
                                  V Offline
                                  Volker75
                                  wrote on last edited by
                                  #67

                                  Thank you!

                                  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