I have a PyQt5 application and most widgets written in Python. I want to write some widget in C++ Qt to make it faster and then embed it into my PyQt QMainWindow.
Is
You can use SIP to create bindings for your C++ code the same way that the PyQt bindings are made.
However, the bindings generated by SIP are themselves C++ code, and in the case of PyQt link directly into the Qt binaries. If you just intend to rewrite PyQt code as C++ then any speedup realised will be negligible, as very little native python is executed in the first place.