“Integrating Qt in legacy MFC applications”

  by Carlos Buchart

Abstract

Many Windows desktop applications written in C++ rely on MFC for the user interface. Compared to MFC, Qt offers a set of more modern tools to develop GUI applications, such as more intuitive and straightforward API, better integration with modern C++, UI designer and localization tools. Nevertheless, migrating this existing (and usually large) code base takes a lot of time, and limited team resources may lead to delay the transition and, therefore, to take advantage of many of the modern Qt features, especially those related to the UX. In this line, while some Qt’s modules can be integrated seamlessly, others offer more problems. One of the best examples is UI-related modules, that present incompatibilities with the MFC core (for example, QDialog is not modal for the MFC application).

This is the case of capture movement and analysis systems at STT Systems, where some of the core applications have been developed since 1998, intensively using MFC, and in 2014 it started the incorporation of Qt as the main framework.

This session will cover the experience in using Qt in legacy projects (more specifically MFC applications). First, we will focus on how you can integrate new modules made using Qt into the existing MFC workflow, given a few constraints that can be removed once the migration is completed. Regarding the GUI, we will discuss how to mix both MFC and Qt interfaces (Qt Widgets) and how to deal with modal Qt dialogs in the MFC events loop. Finally, some words will be said regarding the opposite direction: using existing MFC modules in a Qt application, limitations and considerations.

All these techniques are widely used in the development of end-user applications at STT Systems, and they will be taken as example to show the different cases exposed and how it was managed to mix MFC and Qt, while moving forward the end goal of having all of the code using Qt.

About the speaker

carlos buchart stt systemsCarlos Buchart is a Senior C++ Software Engineer at Wallbox Chargers (Spain), and former Senior Software Engineer at STT Systems (Spain). He has more than 16 years of experience in C++, and more than 10 years using Qt for desktop applications development. Carlos received his MSc in Computer Science from the University of Carabobo (Venezuela) in 2005 and his PhD in Computer Science from the University of Navarra (Spain) in 2010. In 2013 Carlos joined the STT System’s Motion Analysis group as developer of analysis applications for Windows until 2021. Carlos led the transition to Qt, focusing on UI and UX, and developing a large set of libraries for internal use like video recording, database front-ends and licensing.