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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings
Accepted Solution

Newbie QT question about ::connect

Hi everybody,

 

I started working on my first Cascades app, but I ran into a bit of a mystery (at least to me). I have this code:

 

App::App(bb::cascades::Application *app)
: QObject(app)
{
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    app->setScene(root);

    //Initiate managers
    dataManager = new DataManager();

    //Fetch scan button
    Button* scanButton = root->findChild<Button*>("scanButton");
    if(scanButton)
    {
    	QObject::connect(scanButton, SIGNAL(clicked()), dataManager, SLOT(handleScanEvent()));
    }
}

 When trying to compile I get this error:

 

../src/App.cpp:27:90: error: no matching function for call to 'App::connect(bb::cascades::Button*&, const char*, DataManager*&, const char*)'
../src/App.cpp:27:90: note: candidates are:
/Applications/bbndk/target_10_0_9_386/qnx6/usr/include/qt4/QtCore/qobject.h:204:17: note: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
/Applications/bbndk/target_10_0_9_386/qnx6/usr/include/qt4/QtCore/qobject.h:204:17: note:   no known conversion for argument 3 from 'DataManager*' to 'const QObject*'
/Applications/bbndk/target_10_0_9_386/qnx6/usr/include/qt4/QtCore/qobject.h:217:17: note: static bool QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const QMetaMethod&, Qt::ConnectionType)
/Applications/bbndk/target_10_0_9_386/qnx6/usr/include/qt4/QtCore/qobject.h:217:17: note:   no known conversion for argument 2 from 'const char*' to 'const QMetaMethod&'
/Applications/bbndk/target_10_0_9_386/qnx6/usr/include/qt4/QtCore/qobject.h:337:13: note: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
/Applications/bbndk/target_10_0_9_386/qnx6/usr/include/qt4/QtCore/qobject.h:337:13: note:   no known conversion for argument 3 from 'DataManager*' to 'const char*'
cc: /Applications/bbndk/host_10_0_9_52/darwin/x86/usr/lib/gcc/arm-unknown-nto-qnx8.0.0eabi/4.6.3/cc1plus error 1

 I don't see the difference with the Cascades tutorial... I am using the latest SDK. Can anyone point out the error? Thank you in advance.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Newbie QT question about ::connect

Problem solved: I forgot to make DataManager a subclass of QObject.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!