Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML instantiation QWidget problem
Qt 6.11 is out! See what's new in the release blog

QML instantiation QWidget problem

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 530 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SimonHill
    wrote on last edited by aha_1980
    #1

    QML instantiation one QWidget class which have registered to qml, but keyPressEvent can't working,
    BTW,constructor was invoked

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      How are you instanciating that widget ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SimonHill
        wrote on last edited by
        #3

        qmlRegisterType<UpdateWindow>("UpdateWindow.module",1,0,"UpdateWindow"); in the main function
        and then import UpdateWindow.module 1.0 in the qml,
        in QMl instanciating this widget class,
        UpdateWindow{
        id:name_up
        }

        BTW , I have thereafter way to instanciating widget class to qml was ok
        in the main
        {
        UpdateWindow up_wind;
        engine.rootContext()->setContextProperty("up_wind, &up_wind);
        QObject *root = engine.rootObjects()[0];
        root->installEventFilter(&up_wind);
        }
        in qml
        {
        Connections{
        target:up_wind
        }
        }

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Things are not exactly clear. You are instantiating one object of that class in qml and you pass one in the context. What exactly are you trying to do ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved