Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QtWebkit multithreading
Forum Updated to NodeBB v4.3 + New Features

QtWebkit multithreading

Scheduled Pinned Locked Moved Qt WebKit
14 Posts 6 Posters 8.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.
  • D Offline
    D Offline
    dangelog
    wrote on last edited by
    #3

    QtWebkit classes are GUI classes and as such they are meant to be used from the main thread only.

    Software Engineer
    KDAB (UK) Ltd., a KDAB Group company

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ananya
      wrote on last edited by
      #4

      I am passing a new instance of QWebPage to each thread
      MyClass contains imageGenerator()

      @.....in main()...
      QWepPage page = new QWebPage();
      MyClass m = new MyClass();
      QThread thread = new QThread(m)

      page.moveToThread(thread);

      thread.start();
      .....
      @

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #5

        [quote author="ananya" date="1314020743"]I am passing a new instance of QWebPage to each thread
        [/quote]

        I just can emphasize what peppe wrote:

        [quote author="peppe" date="1314019276"]QtWebkit classes are GUI classes and as such they are meant to be used from the main thread only.[/quote]

        So, you must not move the web page to another thread.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ananya
          wrote on last edited by
          #6

          Is there any work around for this then? while still keeping it multi threaded?

          p.s.
          i've found that the part of code that is causing the crash is
          @page.mainFrame().setHtml(str);@

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #7

            [quote author="ananya" date="1314022398"]Is there any work around for this then? while still keeping it multi threaded?[/quote]

            Sure, if you don't mind what you are trying to achieve, we can give advice.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • A Offline
              A Offline
              ananya
              wrote on last edited by
              #8

              I am trying to make an application to convert text to image ...one requirement is that i should be able to run multiple threads since i plan to integrate this with a web server

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dangelog
                wrote on last edited by
                #9

                It's not possible with Qt. Can't you just run multiple processes?

                Software Engineer
                KDAB (UK) Ltd., a KDAB Group company

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #10

                  All you can do is running multiple threads that collect the data (HTML pages) and send that to the QWebPage instances in the main thread.

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    ananya
                    wrote on last edited by
                    #11

                    [quote author="Volker" date="1314056869"]All you can do is running multiple threads that collect the data (HTML pages) and send that to the QWebPage instances in the main thread.[/quote]

                    that wont really serve my purpose of generating images in parallel

                    [quote author="peppe" date="1314023870"]It's not possible with Qt. Can't you just run multiple processes?[/quote]

                    will try to run it as a process..and get back

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      ananya
                      wrote on last edited by
                      #12

                      [quote author="ananya" date="1314062413"]
                      [quote author="Volker" date="1314056869"]All you can do is running multiple threads that collect the data (HTML pages) and send that to the QWebPage instances in the main thread.[/quote]

                      that wont really serve my purpose of generating images in parallel

                      [quote author="peppe" date="1314023870"]It's not possible with Qt. Can't you just run multiple processes?[/quote]

                      will try to run it as a process..and get back
                      [/quote]

                      Suppose i use Callable instead of Runnable threads
                      Is it possible to initialize a new QApplication within each callable's call...when i'm trying this only the first callable runs..the others crash

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        lgeyer
                        wrote on last edited by
                        #13

                        You can only have one Q(Core)Application instance. You might delete the instance and create a new but ... there can be only one!

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          anjna
                          wrote on last edited by
                          #14

                          "You can only have one Q(Core)Application instance. You might delete the instance and create a new but … there can be only one!"

                          How to do this? please help

                          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