[QGIS-Developer] The correct import Qt5 in plugins

Richard Duivenvoorde rdmailings at duif.net
Fri Feb 8 00:16:57 PST 2019


On 2/7/19 9:51 PM, Xavier Corredor Llano wrote:
> On Thursday, 7 February 2019 13:00:48 -05 matteo wrote:
>> better to use
>>
>> from qgis.PyQt import uic
>>
>> so it is QGIS directly that handles the correct PyQt version to import
> 
> that's make sense, thanks Matteo for your answer.
> 
> Regards,
> Xavier Corredor Ll.

@Xavier: some historical background: with the move from qt4->qt5 even
simple plugins written for both python2 and python3 could not be run in
both QGIS/Qt versions because there was always this

from PyQt{VERSION} import QtX

in the Plugins

By abstracting out the version we 'hide' this and make an upcoming Qt
upgrade easier.
It was also possible to fix some things in between.

Regards,

Richard Duivenvoorde


More information about the QGIS-Developer mailing list