Results 1 to 8 of 8

Thread: How to bind Qt3 and Qt4 main event loop.

  1. #1
    Join Date
    Jan 2006
    Location
    Moscow, Russia
    Posts
    23
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Unhappy How to bind Qt3 and Qt4 main event loop.

    Hello All.

    I have a dynamic library. It were written using Qt3. The library export some function with GUI. The functions doesn't contain any Qt3 special classes in interface... It's look like:

    Qt Code:
    1. typedef char* (*pcl_show)(const char*, const char* , const char*, const char*, const char*);
    To copy to clipboard, switch view to plain text mode 

    The function shows some table on screen.

    So, I can use this function in any programming language. I succesfully use it in Delphi and Qt3.

    But when I start use Qt4 and try to include this library in my project I found that window (from my library) does not painting in my application.

    What I must do to use my GUI Qt3 library in Qt4? I think this happend because of difference between QApplication of Qt4 and Qt3. Are they have a common qApp object?



    P.S. Sorry for my "English". English is not my favourite language.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to bind Qt3 and Qt4 main event loop.

    Did you recompile the library for Qt4?

  3. #3
    Join Date
    Jan 2006
    Location
    Moscow, Russia
    Posts
    23
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to bind Qt3 and Qt4 main event loop.

    Quote Originally Posted by wysota
    Did you recompile the library for Qt4?
    No, I didn't. It is very difficult because this library depends on additional Qt3 designer plugins., so I need to recompile this plugins and so on... I just want to use this library in Qt4 with out recompile... Can I do that?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to bind Qt3 and Qt4 main event loop.

    No, you have to recompile. Qt3 and Qt4 use separate event loops, you'd have to create separate QApplication objects and run them in different threads. I don't know if it's possible at all, as this could result in a namespace clash during linking.

  5. #5
    Join Date
    Jan 2006
    Location
    Moscow, Russia
    Posts
    23
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to bind Qt3 and Qt4 main event loop.

    It's hard to understand, but I found a solution. If I create QApplication object in my library (Qt3) first, after that I create QApplication instance in my application (Qt4) then my program begin to work properly

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to bind Qt3 and Qt4 main event loop.

    And both of the loops run in the same thread?

  7. #7
    Join Date
    Jan 2006
    Location
    Moscow, Russia
    Posts
    23
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to bind Qt3 and Qt4 main event loop.

    Quote Originally Posted by wysota
    And both of the loops run in the same thread?
    I did not create any thread manualy but two instance of QApplication. Probably QApplication create own thread and main event loop (?). I don't know exacatly... Can you explain?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to bind Qt3 and Qt4 main event loop.

    Well... If you run QApplication::exec(), it never returns (or to be exact, returns when the application is about to close). To have two event loops running, you'd have to call QApplication::exec() for both application objects.

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.