tags:

views:

1227

answers:

4

Hi,

We currently maintain a suit of MFC applications that are fairly well designed, however the user interface is beginning to look tired and a lot of the code is in need quite a bit of refactoring to tidy up some duplication and/or performance problems. We make use of quite a few custom controls that handle all their own drawing (all written using MFC).

Recently I've been doing more research into Qt and the benefits it provides (cross-platform and supports what you might call a more "professional" looking framework for UI development).

My question is - what would be the best approach to perhaps moving to the Qt framework? Does Qt play nice with MFC? Would it be better to start porting some of our custom controls to Qt and gradually integrate more and more into our existing MFC apps? (is this possible?).

Any advice or previous experience is appreciated.

+2  A: 

(This doesn't really answer your specific questions but...) I haven't personally used Qt, but it's not free for commercial Windows development.

Have you looked at wxWindows which is free? Nice article here. Just as an aside, if you wanted a single code base for all platforms, then you may have to migrate away from MFC - I am pretty sure (someone will correct if wrong) that MFC only targets Windows.

One other option would be to look at the Feature Pack update to MFC in SP1 of VS2008 - it includes access to new controls, including the Office style ribbon controls.

KiwiBastard
Qt is now LGPL-licensed (http://www.heise.de/ix/Qt-Toolkit-mit-LGPL-Lizenz--/news/meldung/121584). AFAIK this means it *is* free for commercial use.
Ulrich Gerhardt
or, in English: http://www.qtsoftware.com/about/news/lgpl-license-option-added-to-qt
gbjbaanb
A: 

It's a tricky problem, and I suspect that the answer depends on how much time you have. You will get a much better result if you port your custom controls to Qt - if you use the QStyle classes to do the actual drawing then you'll end up with theme-able code right out of the box.

In general, my advice would be to bite the bullet and go the whole way at once. Sure, it might take longer, but the alternative is to spend an age trying to debug code that doesn't quite play ball, and end up writing more code to deal with minor incompatibilities between the two systems (been there, done that).

So, to summarise, my advice is to start a branch and rip out all your old MFC code and replace it with Qt. You'll get platform independence (almost) for free, and while it will take a while, you'll end up with a much nicer product at the end of it.

One final word of warning: make sure you take the time to understand the "Qt way of doing things" - in some cases it can be quite different to the MFC approach - the last thing you want to do is to end up with MFC-style Qt code.

Thomi
A: 

@Thomi - I didn't say you couldn't, just that it wasn't free.

KiwiBastard
+7  A: 

In my company, we are currently using Qt and are very happy with it.

I personnally never had to move a MFC-app into using the Qt framework, but here is something which might be of some interest for you :

Qt/MFC Migration Framework

It's part of Qt-Solutions, so this means you'll have to buy a Qt license along with a Qt-Solutions license. (edit: not any more)

I hope this helps !

Jérôme