Recommended WxWidget to QT Migration Guidelines

I have a project that uses the wxwidget toolkit (wxThread, wxString, wxEvent, wxDateTime, wxLog, etc.). I turn to QT.

I was a little discouraged by this task and thought it was best to come here to ask those who had previously performed such an operation.

I have:

  • take a more balanced approach (replace one class at a time - this may not be as straightforward as it seems, as there are some dependencies between the classes)

  • Just plunge into the head first and tear out the guts and reorganize everything in one go (Hmm, that sounds painful ...)

+4
source share
1 answer

I do not know WxWidgets, so I have only half the answer:

  • If this is not already done, try to separate all the logic from the GUI operations before moving to Qt. You can probably achieve this by following Jeremy Miller 's Presentation Templates . This is generally well suited for porting domain classes to GUI classes. This allows you to work in the domain language. The packaging class can then be used in communication with the graphical interface and, in essence, serves as the Adapter class. This makes testing easy and minimal.
  • Avoid callbacks since Qt uses signals and slots. If you need to send a message, call a virtual function - this will simplify the check with Mocks / Fakes / Stubs and follow the open-closed principle , which makes it easy to modify once in Qt.
  • Once your GUI is separated from the application logic, use QTestlib to confirm that you are seeing the correct messages (signals).
  • Finally, be careful with the differences between WxWidgets and Qt. I'm not sure what it is, but wrong assumptions can easily eat your time. In fact, reading docs even in simple widgets will inevitably save you time.
+4
source

Source: https://habr.com/ru/post/1301729/


All Articles