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

Regression: QQuickWidget: Signal from QML to Qt does not work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.1.0 Beta3
    • Quick: Widget
    • None
    • Windows

    Description

      Connecting a QML signal to a C++ signal/slot works in Qt 5.15.2, but it does not work in Qt 6.1.0 beta 3.

      I'm connecting a QML signal to C++ using the following code

      QuickButton::QuickButton(const QUrl &url, QWidget *parent) : QAbstractButton(parent)
      {
          QVBoxLayout *layout;
          layout = new QVBoxLayout(this);
          layout->setSpacing(0);
          layout->setContentsMargins(0, 0, 0, 0);
      
          QQuickWidget *widget = new QQuickWidget(url, this);
          widget->setResizeMode(QQuickWidget::SizeRootObjectToView);
          layout->addWidget(widget);
      
          connect(widget->rootObject(), SIGNAL(clicked()), this, SIGNAL(clicked()));
          widget->rootObject()->dumpObjectInfo();
      }
      

       

      On both Qt 5.15.2 and Qt 6.1.0 beta 3, the output from dumpObjectInfo() is

      OBJECT ConnectionStatusButton_QMLTYPE_0::unnamed
        SIGNALS OUT
              signal: clicked()
                --> QuickButton::unnamed clicked()
        SIGNALS IN
              <None>

       

       However the signal is not received by C++ when using Qt 6.1.0 beta 3.

       

      Attachments

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

        Activity

          People

            tvete Paul Olav Tvete
            jonaslarsson Jonas Larsson
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes