views:

71

answers:

1

I have an existing cross platform project that runs on Mac, Linux and Windows.

Now, I want to add a 'native' UI to it - the ability to show some popup windows (to request user credentials) and perhaps FileOpen dialogs. By native I mean I want to use the systems build in file-open dialog - so on the Mac the mac file finder is shown and on Windows the shells file open window is shown.

Qt seems a good fit - its samples show that it can show the correct dialog on all platforms.

However, all the available Qt samples start at the very base level - assuming the entire project is developed in Qt. Is it possible to initialize and use Qt in a more ad-hoc fashion :- i want to keep all my Qt UI code in a seperate dll/dylib/so file with some simple exports (think ShowLoginPopup).

+1  A: 

I think that the easiest approach would be to do it the other way around - having the Qt GUI drive the rest of the application. Qt is event based and does rely on its event loop, so you need to keep that running.

e8johan
that is really not an option. The app already has an event loop and refactoring that now would be a huge pita. When combining multiple frameworks that all insist on their own event loops - perhaps I could run Qt on a thread. I don't know though how even loops work on OSs other than windows.
Chris Becke
@Chris Becke... The Qt code gets upset if its UI code is not running on the main (first) thread in a program. However, it does work well in a threaded environment besides that.
Caleb Huitt - cjhuitt
what event loop is your app running? Qt is compatible with the glib event loop. Otherwise, you could thread it as cjhuitt says.Have you considered a client/server architecture with an XML RPC or DBUS connection between two separate clients?
e8johan