With the release of Qt6 many people are itching to get started porting their existing applications over to PyQt6 and PySide6. However, as with any new releases there are some rough edges to be aware of.
Reader Boštjan asked:
I have successfully ported all of my codebase from PyQt5 to PyQt6, thanks to Martin's tutorial. It helped a lot! I have, however, one area of my codebase that can't be ported to PyQt6. Since Qt6 removed QtMultimedia, PyQt6 / PySide6 as a consequence don't have it anymore. Do you have any news on whether QtMultimedia is coming back anytime soon, if at all?
Qt6 is still new and as such not all of the Qt modules have been ported yet, and so are not available in PyQt6 or PySide6. If you're using any of these modules you'll want to postpone upgrading to v6 until they are available -- once they're added to Qt6 they will be available in a subsequent release of PyQt6 & PySide6. The good news is the porting has already started, and as of Qt 6.1 the following modules are now available. If you're using an earlier version of PyQt6/PySide6, upgrade now!
- Active Qt
- Qt Charts
- Qt Quick Dialogs (File dialog)
- Qt ScXML
- Qt Virtual Keyboard
For the following modules you'll need to wait for Qt 6.2.
- Qt Bluetooth
- Qt Data Visualization
- Qt Lottie Animation
- Qt Multimedia
- Qt NFC
- Qt Positioning
- Qt Quick Dialogs: Folder, Message Box
- Qt Remote Objects
- Qt Sensors
- Qt SerialBus
- Qt SerialPort
- Qt WebChannel
- Qt WebEngine
- Qt WebSockets
- Qt WebView
Qt 6.2 is scheduled for release in September 2021.
For Python applications built with Qt the two in bold are likely to be the biggest issues.
What can I do instead?
I was using QtMultimedia's QSound() class to play WAV sound files by using its play() method. What do you guys propose I use now to play WAV sound files? Is there something similar to QtMultimedia.QSound() in PyQt6 / PySide6? If it is, I can't find it. If not, I need something that is cross-platform (Windows, Linux, Mac) and simple to implement.
If you're using Qt Multimedia to play sounds in your application you could switch over to the Python library
playsound instead. This is across-platform single-function library which will play sounds for you. But for anything else you're going to want to wait for the Qt 6.2 update: integrating anything more complicated with your Qt app is going to require much more work than it's really worth.
Purchasing Power ParityDevelopers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Is it time to upgrade?
Whether or not it's time to upgrade is entirely dependent on your project. If you're using modules that aren't available, you can't upgrade yet. If you're just starting out learning Python GUI programming you may prefer to stick with PyQt5/PySide2 for the time being -- there are more examples available and while the differences are minor anything not working is confusing when learning. Anything you learn using PyQt5/PySide2 will carry over when you do choose to upgrade to Qt6.
If you like to be on the bleeding edge and want to get started with Python & Qt6, the PyQt6 and PySide6 editions of my books are available with all code examples updated for the new version.