Question

I am about to start designing a UI. The UI is expected to be complex and will have several screens one of which will be a text editor. The application is in C++ and in order to leverage some existing functionality, I have decided to use Qt for the UI. However, I want to be able to write the UI in such a way that it is easy to replace Qt with any other UI library at a later point - or even use different libraries for different platforms.

I am leaning towards containing the QT objects in my own classes and using my classes throughout. Is this a good design? I preferred this as opposed to sub-classing(which is recommended by Qt) as subclassing seems to be a very rigid binding. However, this means that I will have to write a wrapper for every method that Qt exposes and I will also not be able to use QtCreator.

What do you think? Could you describe the advantages/disadvantages of the choice of method. It would be great if you could point me to any examples or to any good design principles.

Was it helpful?

Solution

You don't. The GUI libraries are the abstraction. If you really want to compile your application with different backends - you might look into WxWidgets. But be warned - the library is very different from Qt.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top