[QGIS-Developer] QgsDockWidget does not seem to work with loadUiType

Denis Rouzaud denis.rouzaud at gmail.com
Thu Jan 11 05:24:07 PST 2018


Hi all,

I think this is not currently feasible with PyQt5 at the moment (using
QgsDockWidget as a top class for a UI and loading it with uic.loadUiType)

Here is a description of the issue on PyQt mailing list
https://www.riverbankcomputing.com/pipermail/pyqt/2017-October/039647.html

Here is a part of the reply from Phil Thomson:

> I can confirm it is a bug, however the fix is non-trivial so it won't get
fixed quickly. The fundamental problem is that the code has the assumption
that all custom widgets will reside in the PyQt5 package hard-coded (but
even then it's not quite as simple as that).

I just pinged Phil to get an update on this as he said he would fix it.

Best wishes,

Denis

Le mer. 10 janv. 2018 à 18:02, Nyall Dawson <nyall.dawson at gmail.com> a
écrit :

> On 11 January 2018 at 07:37, C Hamilton <adenaculture at gmail.com> wrote:
> > I seem to remember seeing something that said that QgsDockWidget should
> be
> > used rather than QDockWidget. I was trying it today, but it generates the
> > error below in this line of code.
> >
> > FORM_CLASS, _ = loadUiType(os.path.join(
> >     os.path.dirname(__file__), 'ui/zoomToLatLon.ui'))
> >
> > Has anyone had problems with this or should I not use QgsDockWidget and
> > stick with QDockWiget? I'm trying this on QGIS 2.99.
> >
> > AttributeError: module 'PyQt5.QtWidgets' has no attribute 'QgsDockWidget'
>
> It's not a PyQt class - it's in the QGIS gui library:
>
> from qgis.gui import QgsDockWidget
>
> Nyall
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180111/7e8c759f/attachment-0001.html>


More information about the QGIS-Developer mailing list