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>
  • Wouldn't it be easier to just replace the Qt3 widgets with their Qt4 equivalents in the .ui file? – Matthias Kuhn Jun 27 '16 at 9:16
  • @MatthiasKuhn - Is there Qt4 equivalent to a Qt3ButtonGroup? There's a radioButtonExclusive setting in the Qt3ButtonGroup which I would like to test :) – Joseph Jun 27 '16 at 9:27
  • ...I guess I found my answer... – Joseph Jun 27 '16 at 9:36
  • 1
    ... :) :) :) ... – Matthias Kuhn Jun 27 '16 at 10:03
  • @MatthiasKuhn - Consider posting it as an answer please, going to have a proper read through the Qt docs now =) – Joseph Jun 27 '16 at 10:07
4
+50

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.