Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Best practice to connect signals between objects created using the qmlRegisterType() method?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Best practice to connect signals between objects created using the qmlRegisterType() method?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.1k 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.
  • F Offline
    F Offline
    FreddeB
    wrote on last edited by
    #1

    Hi,

    I have a problem by getting a segmentation fault when connecting a signal between two objects defined by qmlRegisterType(). I know that it's probably beause the objects aren't created when I'm trying to call the Connect (...) method.

    What is the best practice to connect signals between objects that are created in the QML context through the qmlRegisterType() method?

    Shall I emit a signal in Component.onCompleted and make a slot where all my connection is called or is there a signal emitted automatically from the QML context when all objects defined in QML are created?

    I know that the objects are created since I use the objects in the qml file.. I make a qDebug() in the constructor that is executed...

    Any advice is appreciated !
    Fredrik

    Regards
    Fredrik

    1 Reply Last reply
    0
    • F Offline
      F Offline
      FreddeB
      wrote on last edited by
      #2

      I choose a more simpel approach by skipping the qmlRgisterType() ..

      I create all instances in the c++ context and do ..

      MyClass class;
      QQmlContext *ctxt = view.rootContext();
      ctxt->setContextProperty("MyClass", &class);

      // Setup signals and slots..

      /Fredrik

      Regards
      Fredrik

      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