Results 1 to 2 of 2

Thread: How to do Qt UI in a DLL used by Qt / Non-QT apps

  1. #1
    Join Date
    Mar 2006
    Posts
    46
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to do Qt UI in a DLL used by Qt / Non-QT apps

    I am creating a DLL (and perhaps a dylib for OSX) that interfaces to some hardware that for the most part has no UI at all. If the DLL detects that the hardware's firmware is out of date, I want it to be able to pop up some simple message boxes to get the user's approval to update the firmware.

    So for my DLL to do this via Qt, it needs to have a QApplication and a QApplication::exec() loop running right? The problem is, the hosting app may be:

    (1) A Qt based application already running its own QApplication loop - how would I detect and use this?

    (2) A non-Qt application running its own message loop of some form. How do I join this message loop? Or can I just start my own QApplication loop in another thread?

    (3) A non-Qt application with no message loop (e.g. a console app). Is it possible for my DLL to start a GUI from inside a console app?

    Thanks,

    Colby
    Last edited by cboles; 25th August 2008 at 21:01.

  2. #2
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to do Qt UI in a DLL used by Qt / Non-QT apps

    That's going to be a very bumpy ride... I am looking at this from a Linux
    perspective with limited insight in Qt on Windows. So as this highly
    platform dependent, take it with a grain of salt. Or maybe two...

    (3) That's probably the simplest case. This should just work,
    possibly after fiddling a bit with compiler/linker settings.

    (2) should also "work" if you don't care about a responsive main application
    while the Qt dialog runs. This might be ok but will look unprofessional.
    For proper event loop interaction you'll need a toolkit specific solution like
    http://trolltech.com/products/qt/add...s/qtwinmigrate.
    There's something similar for Motif applications.

    (1) Qt-plugin in Qt-application. If it's the same version of Qt I'd
    try to avoid to instantiate a second QApplication in the dll and
    work with the QApplication in the hosting application. That should
    work. I have a suspicion that everything else will get really ugly.

    Of course, fitting everything of that into a single .dll will be a
    challenge of its own ;-}

Similar Threads

  1. How to ship Qt apps?
    By Morea in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd June 2008, 12:22
  2. QT 4.4: CLI apps?
    By Hossie in forum Qt Programming
    Replies: 6
    Last Post: 19th May 2008, 11:37
  3. Distributing apps on a CD
    By munna in forum General Discussion
    Replies: 1
    Last Post: 1st November 2006, 21:45
  4. Using qmake to build multiple apps and libs
    By marchand in forum Newbie
    Replies: 2
    Last Post: 12th June 2006, 17:33
  5. signals and slots between 2 Apps?
    By nupul in forum Qt Programming
    Replies: 9
    Last Post: 12th April 2006, 11:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.