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. TWAIN DLL that spawns a thread that creates a GUI works on Qt 4.8 died on Qt 5.1.1
QtWS25 Last Chance

TWAIN DLL that spawns a thread that creates a GUI works on Qt 4.8 died on Qt 5.1.1

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.7k 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.
  • A Offline
    A Offline
    astodolski
    wrote on last edited by
    #1

    I’m trying to understand how Qt 4.8 changed – maybe in terms of threading.

    I created a DLL for a TWAIN compliant app. This DLL is controlled by an application which is the main thread (it is not a Qt application) . This DLL then spawns a thread and in that thread creates and displays a GUI.

    This model structure seemed to work without issue in Qt 4.8.4. Having migrated to Qt 5.1.1 the DLL builds and runs but there are no QDialog messages that are being processed – the GUI has no controls working - seems dead, just displays.

    First question is: Is this model/structure possible in Qt 5? Was there changes that would affect this from working as it did in Qt 4.8?

    Second question: Is there a preferred way of doing this? This structure is for creating a TWAIN data source. Anyone having any mileage with writing TWAIN compliant apps please chime in.

    Thanks in advance

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      GUI-related objects in Qt were never supported outside of the main thread. I'm surprised that you say it worked in Qt 4.8; I think you got very lucky, because it is undefined behaviour.

      Qt 5 came with a massive restructuring of the GUI rendering engines, which is probably why the 2 versions produced different (undefined) behaviours.

      I think your best bet is to stick with Qt 4.

      P.S. Did you create a QApplication in your DLL? It's needed to create a QDialog, but it's supposed to complain if you create it outside the main thread.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • A Offline
        A Offline
        astodolski
        wrote on last edited by
        #3

        [quote author="JKSH" date="1384915837"]Hi,

        GUI-related objects in Qt were never supported outside of the main thread. I'm surprised that you say it worked in Qt 4.8; I think you got very lucky, because it is undefined behaviour.

        Qt 5 came with a massive restructuring of the GUI rendering engines, which is probably why the 2 versions produced different (undefined) behaviours.

        I think your best bet is to stick with Qt 4.

        P.S. Did you create a QApplication in your DLL? It's needed to create a QDialog, but it's supposed to complain if you create it outside the main thread.[/quote]

        QApplication is created in the run method of the thread that is spawned from the DSM (TWAIN data source manager). It worked fine in Qt 4.8 - really. It didn't complain

        So the fact that I COULD actually create a UI via QApplication in Qt 4.8 you're calling undefined. Regardless, the massive restructuring of the GUI module referred to may be a contributor to the issue that I am seeing.

        Thanks

        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