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
New Developer
Posts: 67
Registered: ‎11-24-2008
My Device: Not Specified
Accepted Solution

Importing QtQuick, onThumbNail() not working

Hi!

 

The documentation for Application:

 

https://developer.blackberry.com/cascades/reference/bb__cascades__application.html#thumbnail

 

Provides the following code for onThumbnail:

 

import QtQuick 1.0
import bb.cascades 1.0
 
Page {
    Container {
        // The Connections element is not visual and must be an attached object.
        attachedObject: [
            Connections {
                target: Application
                onThumbnail: {
                    applicationThumbnailed();
                }
            }
        ]
    }
    // Other QML
}

 

However as soon as I import QtQuick, the app deploys, opens, then stays on the BlackBerry loading screen. Commenting this out fixes the problem (but obviously then the Connections element doesn't work).

 

Not sure why I have to import QtQuick in the first place, I thought Cascades is a separate qt branch than qtquick?

 

I notice there are a few people that have got active frames/covers to work, but the code is c++/doesn't address the onThumbnail changes.

 

Any ideas? 

 

I'm trying to capture the events where the app is no longer in focus, so I can show a particular 'pause' screen (as if the user had hit the pause button in-app). 

 

 

Kind Regards,

 

Med

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Importing QtQuick, onThumbNail() not working

That looks as though it should work. Where's the applicationThumbnailed() function? Have you tried replacing that call with a simple console.log() call to see if you get the output (via slog2info)?

Also I posted an update to a thread on active frames just yesterday, describing how to do it entirely from QML (other than having to register two classes in the C++ first).

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!
New Developer
Posts: 67
Registered: ‎11-24-2008
My Device: Not Specified

Re: Importing QtQuick, onThumbNail() not working

I defined the function myself - however if I remove everything EXCEPT the import of QtQuick, the app doesn't work. So with my normal app, but importing QtQuick, it doesn't load. Removing the import works fine :\

 

Thanks - I am looking at your code now. Have you played at all with the onThumbnail / onInvisible / etc functions? i.e. the triggers when the app is minimised? I will have a go setting an application cover in the morning! Smiley Happy

 

I guess I'm concerned because it seems to be part of the 'Connections' element, which doesn't seem to exist in Beta 3. I've done some digging, only one other thread seems to exist on this topic (back in June), but was inconclusive

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Importing QtQuick, onThumbNail() not working

I've noted elsewhere that using Connections does work fine, provided you import QtQuick like that. (At least, I verified it with beta 3 in an early test, but haven't used it since.)

I do use most of those window and app state signals, most especially Application.thumbnail. The specific line I'm using fits into a larger framework to support this across multiple apps, but it currently looks like this:

    Application.thumbnail.connect(function () { dispatch('windowStateChanged', {state: 'thumbnail'}) });

Obviously my dispatch() function is reused for the other signals etc, but point is it does work fine for me.  I actually use it to trigger saving my app state, e.g. for settings changes, since it offends me to write to the file system every time the user changes a single setting (when they may change another 10 immediately following)... Smiley Happy


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!
New Developer
Posts: 67
Registered: ‎11-24-2008
My Device: Not Specified

Re: Importing QtQuick, onThumbNail() not working

You sir, are amazing. 

 

That worked a treat.

 

THANK YOU Smiley Happy