<p>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).</p>

<p>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).</p>

<p>My question is - <strong>what would be the best approach to perhaps moving to the Qt framework</strong>?  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?).</p>

<p>Any advice or previous experience is appreciated.</p>

[{'answer_id': 27646, 'author': 'JamesSugrue', 'author_id': 1075, 'author_profile': 'https://Stackoverflow.com/users/1075', 'pm_score': 2, 'selected': False, 'text': '<p>(This doesn\'t really answer your specific questions but...)\nI haven\'t personally used Qt, but it\'s not free for commercial Windows development.</p>\n\n<p>Have you looked at <a href="http://wxwindows.org/" rel="nofollow noreferrer">wxWindows</a> which is free? Nice article <a href="http://www.linuxjournal.com/article/6778" rel="nofollow noreferrer">here</a>. 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.</p>\n\n<p>One other option would be to look at the <a href="http://msdn.microsoft.com/en-us/library/bb983962.aspx" rel="nofollow noreferrer">Feature Pack update</a> to MFC in SP1 of VS2008 - it includes access to new controls, including the Office style ribbon controls.</p>\n'}, {'answer_id': 27651, 'author': 'Thomi', 'author_id': 1304, 'author_profile': 'https://Stackoverflow.com/users/1304', 'pm_score': 0, 'selected': False, 'text': '<p>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.</p>\n\n<p>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 <em>quite</em> play ball, and end up writing more code to deal with minor incompatibilities between the two systems (been there, done that).</p>\n\n<p>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.</p>\n\n<p>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.</p>\n'}, {'answer_id': 27811, 'author': 'Jérôme', 'author_id': 2796, 'author_profile': 'https://Stackoverflow.com/users/2796', 'pm_score': 4, 'selected': True, 'text': '<p>In my company, we are currently using Qt and are very happy with it.</p>\n\n<p>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 :</p>\n\n<p><strike><a href="http://www.qtsoftware.com/products/appdev/add-on-products/catalog/3/Windows/qtwinmigrate/" rel="nofollow noreferrer">Qt/MFC Migration Framework</a></strike></p>\n\n<p><a href="http://doc.qt.nokia.com/solutions/4/qtwinmigrate/index.html" rel="nofollow noreferrer">Qt/MFC Migration Framework</a></p>\n\n<p>It\'s part of Qt-Solutions, so this means you\'ll have to buy a Qt license along with a Qt-Solutions license. (edit: <a href="http://www.qtsoftware.com/about/news/lgpl-license-option-added-to-qt" rel="nofollow noreferrer">not any more</a>)</p>\n\n<p>I hope this helps !</p>\n'}, {'answer_id': 10913478, 'author': 'Stefan', 'author_id': 861970, 'author_profile': 'https://Stackoverflow.com/users/861970', 'pm_score': 0, 'selected': False, 'text': '<p>I have lead a team doing this kind of thing before (not MFC to QT but the principles should work).</p>\n\n<p>First we documented the dialogs and what their inputs, controls and outputs were.  Also, we create several test cases especially for any clever logic inside the GUI.</p>\n\n<p>Sometimes we had to refactor some business logic to provide a clean interface the GUIs but this is the way it should have been done in the first place tbh.</p>\n\n<p>Now we had a list of GUIs, inputs, outputs, tests and an interface that the encapsulated GUI had to match.</p>\n\n<p>We began, project by project, to create equivilant GUIs to the old ones.  Once we did that we could slot the GUI in where the old one was, rebuild and test it.  At first we tripped a lot but we soon worked out the common errors and fixed them.  We navigated (I think) 612 dialogs although there was a team of about a dozen of us working on it.</p>\n'}]
['https://Stackoverflow.com/questions/27640', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2958/']