Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 160
Registered: ‎01-27-2012
My Device: Playbook
My Carrier: Rogers

Signals to Attached Objects

I trying to send a custom signal to an attachedObject, but it doesn't seem to be recieving it.  Is there something more that is required for signals to communicate with QML?  ImageTracker receives the onStateChanged when its attached to the same Imageview, so I know these attached objects can receive signals.

 

Here is the qml of the imageview:

import com.rim.example.custom 1.0

Imageview { attachedObjects: [ ImageLoader { id: loader onTesting: { console.log("Image Loader testing"); // this doesn't output } } }

Here's where its attached in the main app:

	qmlRegisterType<ImageLoader>("com.rim.example.custom", 1, 0, "ImageLoader");

 

 

And here is the Cpp Constructer with the test signal:

 

   
    ImageLoader::ImageLoader(QObject* parent) :
    		QObject(parent), m_imageUrl(""), m_executeThread(NULL) {
    qDebug() << "Image Loader Contructor"; // this outputs emit testing(); }

 

And here is where I included the signal in the hpp file

Q_SIGNALS:
    void testing();
    

 

Is there another step that is required to make cpp signals communicate with QML?

 

 

 

 

---
If you find my post helpful please "like" it and "accept as a solution"
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Signals to Attached Objects

[ Edited ]

The seperate code parts look fine I think the problem is trying to emit the signal in the constructor.

 

Try emitting the signal after the object construction and it should be fine.

 

Now can someone please answer the harder case of how to do this for dynamic creation...

 

http://supportforums.blackberry.com/t5/Cascades-Development/Capturing-signal-in-new-NavigationPane-s...


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.