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
Highlighted
New Contributor
Posts: 7
Registered: ‎02-20-2013
My Device: Developer
My Carrier: Developer
Accepted Solution

Can't connect ListView triggered signal with slot (C++)

[ Edited ]

Class Definition:

class MyPage : public bb::cascades::Page
{
	public slots:
		void openSheet(QVariantList indexPath);
//...
};

 Constructor:

ListView *pListView = new ListView();
Q_ASSERT(QObject::connect(pListView, SIGNAL(triggered(QVariantList)),
						this, SLOT(openSheet(QVariantList))));

The above assert fails, and I can't seem to figure out why (other than the obvious "couldn't connect".) Any help is appreciated.

BB10 Native SDK 10.0.10.261 running in the simulator.

Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Can't connect ListView triggered signal with slot (C++)

What exactly is the couldn't connect error that is output in your console? Usually it says something useful like specifically that either the signal or slot doesn't exist.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
New Contributor
Posts: 7
Registered: ‎02-20-2013
My Device: Developer
My Carrier: Developer

Re: Can't connect ListView triggered signal with slot (C++)

slogger2 buffer handle not initialized. ../../lgmon_api.c, logEvent(), around line 578!

 is the only thing in there.

Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Can't connect ListView triggered signal with slot (C++)

[ Edited ]

You haven't attached a message handler then, presumably?

Might as well do that first.

 

In main.cpp add this above your main function:

 

void myMessageOutput(QtMsgType type, const char* msg){
    Q_UNUSED(type);

    fprintf(stdout, "%s\n", msg);
    fflush(stdout);
}

 then inside your main function add this:

 

#ifdef QT_DEBUG
    qInstallMsgHandler(myMessageOutput);
    qDebug() << "RUNNING DEBUG BUILD";
#endif

 

Then run the app again and see what output you get.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
New Contributor
Posts: 7
Registered: ‎02-20-2013
My Device: Developer
My Carrier: Developer

Re: Can't connect ListView triggered signal with slot (C++)

Now that's handy.

Object::connect: No such slot bb::cascades::Page::openSheet(QVariantList)

 so for some reason it's trying to access the parent's function.

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: Can't connect ListView triggered signal with slot (C++)

Hi TMcLennan, 

 

 

      Can you do like this.

 

      

	connect(pListView, SIGNAL(triggered(const QVariantList)), this,
	 SLOT(openSheet(const QVariantList)));

     I hope now your prolbem solved.

 

-------------------------------------------------------------------------------

 

feel free to press the like button on the right side to thank the user that helped you.

New Contributor
Posts: 7
Registered: ‎02-20-2013
My Device: Developer
My Carrier: Developer

Re: Can't connect ListView triggered signal with slot (C++)

I found that that worked with the contact picker the other day, shahumang8, but the params in the headers for ListView aren't const Smiley Sad

Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Can't connect ListView triggered signal with slot (C++)

You could try this, I'm not sure it's necessary, but it couldn't hurt:

 

class MyPage : public bb::cascades::Page
{
Q_OBJECT

	public slots:
		void openSheet(QVariantList indexPath);
//...
};

 

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Can't connect ListView triggered signal with slot (C++)

Could you show the definition in the cpp of the function openSheet as well? I don't really care about implementation, just how the header is defined in the cpp.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
New Contributor
Posts: 7
Registered: ‎02-20-2013
My Device: Developer
My Carrier: Developer

Re: Can't connect ListView triggered signal with slot (C++)

void MyPage::openSheet(QVariantList indexPath)
{
	Sheet* pMySheet = Sheet::create()
	                  .content(Page::create())
	                  //.onClosed(this, SLOT(onClosedHandler())
	                  .open();
}

adding Q_OBJECT

resulted in the following compile error: undefined reference to `vtable for MyPage'

 

I was also looking into this, but it didn't seem to work.

http://developer.blackberry.com/cascades/reference/custom-types.html