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

Crash when accessing enums defined in QML_SINGLETON class

    XMLWordPrintable

Details

    • Windows
    • 8cbb30a65 (dev), 22e00e414 (6.4), 56c652f00 (6.5), 039848612 (tqtc/lts-6.2)

    Description

      
      #include <QObject>
      #include <QQmlEngine>
      
      class DummyObjekt : public QObject
      {
          Q_OBJECT
          QML_ELEMENT
          QML_SINGLETON // This causes the crash
      
      public:
          enum Test {
              TestA = 1,
              TestB
          };
          Q_ENUM(Test)
      
      public:
          explicit DummyObjekt(QObject *parent);
      };
      
      import QtQuick 2.15
      import QtQuick.Controls.Material 2.0
      import QtQuick.Layouts 1.3
      
      import com.test
      
      ApplicationWindow {
          id: window
          width: 640
          height: 480
          visible: true
          title: qsTr("Test")
      
          Button {
              id: btn
              text: "Click me"
              onClicked: {
                  console.log("Dummy: " + DummyObjekt.TestA); // Crash
              }
          }
      }
      

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            Harald Meyer Harald Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: