Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84424

UIC should handle Button Groups with Custom Widgets derived from QAbstractButton

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.5, 5.12.8
    • Build tools: uic
    • None

    Description

      We have a custom Button derived from QAbstractButton, and we're using it on a UI file.

      The custom button is added to a Button Group.

      When compiling the UI file into a .h file, no setup is implemented for the custom button, and if no other non-custom button is used, the Button Group is not even instantiated.

      This is due to the result of the `isButton()` function  call in `cppwritedeclaration.cpp` line 634.

      Indeed that function returns true only for classes derived from some classes derived from `QAbstractButton`, but strangely enough, not from `QAbstractButton` .

      See `uic.cpp` lines 256:

      ```

      bool Uic::isButton(const QString &className) const{ return customWidgetsInfo()>extends(className, QLatin1String("QRadioButton")) || customWidgetsInfo()>extends(className, QLatin1String("QToolButton")) || customWidgetsInfo()>extends(className, QLatin1String("QCheckBox")) || customWidgetsInfo()>extends(className, QLatin1String("QPushButton")) || customWidgetsInfo()->extends(className, QLatin1String("QCommandLinkButton"));}

      ```

      Adding `QAbstractButton` in that test fixes the issue and the code is generated correctly. the Custom Widget works fine and the Button Group correctly handles the functionality.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jkobus Jarek Kobus
            f.fuga Federico Fuga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes