3

Similar to this post: My plugins crashes with “No module named qgsprojectionselectionwidget” in Windows.

Except I would like to also use Qt3 Support widgets (in particular, a Q3ButtonGroup). However, QGIS does not recognise it and provides the following error:

NoSuchWidgetError: Unknown Qt widget: Q3GroupBox

To solve it with QGIS custom widgets, you can add qgis.gui to the ui file.

Is there a similar fix (or any fix) for Qt3 Support widgets?


Here is an example of my "dockwidget_base.ui" file:

  <customwidget>
   <class>Q3GroupBox</class>
   <extends>QGroupBox</extends>
   <header>Qt3Support/Q3GroupBox</header>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>Q3ButtonGroup</class>
   <extends>Q3GroupBox</extends>
   <header>Qt3Support/Q3ButtonGroup</header>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>QgsCollapsibleGroupBox</class>
   <extends>QGroupBox</extends>
   <header>qgscollapsiblegroupbox.h</header>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>QgsMapLayerComboBox</class>
   <extends>QComboBox</extends>
   <header>qgsmaplayercombobox.h</header>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections/>
</ui>
Joseph
  • 75,746
  • 7
  • 171
  • 282

1 Answers1

4

The widgets which you are referring to are leftovers from Qt3.

QGIS at the moment is based on Qt4 (which exists since 2005 and has seen end of life in December 2015) and is soon to be updated to Qt5 (2016/2017).

Ten years ago, when it was about moving applications from Qt3 to Qt4, a Qt3Support module has been introduced to ease the migration. However, right now there are better replacements for all of the components in this module and there is no reason to maintain any code based on this compatibility module.

You are advised to look for the Qt4 replacements for the widgets you use for an up-to-date code. And as you said in you comment, you already found your answer.

See also http://doc.qt.io/qt-4.8/qt3support-module.html#details

Warning: The classes in this module are intended to be used in intermediate stages of a porting process and are not intended to be used in production code.

Matthias Kuhn
  • 27,780
  • 3
  • 88
  • 129