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. QML and Own C++ Object/Plugin
Forum Updated to NodeBB v4.3 + New Features

QML and Own C++ Object/Plugin

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 850 Views 2 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.
  • V Offline
    V Offline
    VeNToR
    wrote on last edited by
    #1

    Hi;

    I wrote my own plugin and object. Problem is, C++ object's parent always null... Why ?

    In QML :
    ...
    ChRSM
    {
    id : chRSM
    }
    ...

    In C++ :
    CChRSM::CChRSM(QObject* ChParent /= NULL/)
    : QObject(
    ChParent)
    ....

    Thanks...

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

      Hi
      You mean you made a custom QML component in c++ and when used
      in QML, the c++ object created by the engine is
      not being given a parent in constructor?

      But what is the parent in QML you show ?

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VeNToR
        wrote on last edited by
        #3

        exactly, problem is as you define. I am beginner for QML. I just define the object as follows;

        ApplicationWindow
        {
        id : window
        width : 360
        height : 520
        visible : true
        title : "Quasar"

        header: ToolBar
        {
        	id					: chObject
        	Material.foreground	: "white"
        
        	RowLayout
        	{
        		spacing			: 20
        		anchors.fill	: parent
        
        		ChRSM
        		{
        			id		: chRSM
        		}
        

        .
        ...
        ....

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

          Hi
          Like here i guess
          http://doc.qt.io/qt-5/qtqml-tutorials-extending-qml-example.html

          Maybe parent is set after CChRSM is constructed.

          What is the problem with parent being NULL ?

          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