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
jamiejulius
Posts: 46
Registered: ‎06-06-2012
My Carrier: Pelephone
Accepted Solution

QML Connections Element

Hi,

 

I'm trying to use the QML "Connections" element. So far without luck.

 

Attempt 1:

 

import bb.cascades 1.0

Page {
  content: Container {
    Label {
      text: "Hi"
    }
  }

  Connections {
  }
}

 

This yields: "Connections is not a type".

 

Fair enough, I added an import...

 

Attempt 2:

 

import Qt 4.7
import bb.cascades 1.0

Page {
  content: Container {
    Label {
      text: "Hi"
    }
  }

  Connections {
  }
}

 

This yields: "Cannot assign to non-existent default property"

 

Attempt 3:

Moved the Connections element into the Container.

 

This yields: "Cannot assign object to list"

 

What am I doing wrong?

 

Thanks,

 

Jamie

 

 

 

 

Please use plain text.
Developer
peter9477
Posts: 6,448
Registered: ‎12-08-2010
My Carrier: none

Re: QML Connections Element

It sounds like you're mixing things from QtQuick with Cascades. That won't work, even if you were to add "import QtQuick 1.1" which would be required even to make the name "Connections" visible in the namespace. You can't mix Cascades and QtQuick in the same app....

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
jamiejulius
Posts: 46
Registered: ‎06-06-2012
My Carrier: Pelephone

Re: QML Connections Element

I have no idea if it is part of Qtquick. I thought it was part of basic QML as I read about it here: http://doc.qt.nokia.com/4.7-snapshot/qml-connections.html.

 

Thanks,


Jamie

Please use plain text.
Developer
peter9477
Posts: 6,448
Registered: ‎12-08-2010
My Carrier: none

Re: QML Connections Element

QML is basically the syntax, but all the things you see there are part of QtQuick, which you can think of as a particular set of QML components that are built on top of the QDeclarative package. Cascades is a "competing" set of QML components built on top of QDeclarative, and it includes effectively none of the QtQuick capabilities, except where they've explicitly supplied work-alike items. The only things you can use in Cascades are those documented in its own docs. I believe that means everything that's a subclass of this: https://developer.blackberry.com/cascades/reference/bb__cascades__uiobject.html

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
jamiejulius
Posts: 46
Registered: ‎06-06-2012
My Carrier: Pelephone

Re: QML Connections Element

Thank you!

 

Your explanation is extremely helpful.

 

Cheers,

 

Jamie

Please use plain text.
Developer
peter9477
Posts: 6,448
Registered: ‎12-08-2010
My Carrier: none

Re: QML Connections Element

Turns out I was wrong about this, and it's only the visual elements (basically) which cannot be mixed with Cascades. The Connections class is still available, as noted here http://supportforums.blackberry.com/t5/Cascades-Development/QtQuick-Connections-element-C-signals-in...


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
jamiejulius
Posts: 46
Registered: ‎06-06-2012
My Carrier: Pelephone

Re: QML Connections Element

Hi Peter,

 

Thanks for taking the time to update this thread.

 

To be honest, I can't remember what I wanted to use this for. :-)

 

Perhaps in the future this will come in handy...

 

Cheers,

 

Jamie

 

Please use plain text.
New Contributor
geoidesic
Posts: 9
Registered: ‎12-26-2012
My Carrier: Vodacom (Vodaphone)

Re: QML Connections Element

I would like to know how to do this. The use would be if you have a ControlDelegate sending a signal to which you want to connect.

 

There are no examples available of how to do this.

 

I tried import QtQuick 1.0 but I still get the same errors as described above.

Please use plain text.
New Contributor
geoidesic
Posts: 9
Registered: ‎12-26-2012
My Carrier: Vodacom (Vodaphone)

Re: QML Connections Element

[ Edited ]

Right, this does work in cascades..

 

  • import QtQuick 1.0
  • make sure that your Connections are created in attachedObjects 
  • value of the "target" property for the Connection must be ControlDelegate.control (ControlDelegate being the id of your control delegate object)
  • the Connections object must be defined after your ControlDelegate is defined, else the signal won't exist when the Connection is created and you'll get an error.

 

Please use plain text.
New Contributor
Freyr
Posts: 3
Registered: ‎12-28-2012
My Carrier: RIM

Re: QML Connections Element

[ Edited ]

Hi geoidesic and peter9477,

 

Thanks your wonderful sharing about this 'Connections' topic, I have been looking for a way to send a signal from C++ to QML for two days. tried and tried, almost gave up.

 

Now I back to the correct track. Those QtQuick/Cascades difference are really confussing sometime.

Please use plain text.