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
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: How can I create a ui with my code for 2.1

oh, well if you're able to somehow retrieve a screen_window_t, then you can directly query it's group and join your new window to that group.

 

screen_get_property_cv((screen_window_t)window->winId(), SCREEN_PROPERTY_GROUP, &dest);

But yes, that's terribly prone to breaking if there is ever an implementation change, as mcquire points out.

 

Definitely follow whatever the recommented QPlatformNativeInterface route is.

 

Cheers,

Sean

 

 

Please use plain text.
Trusted Contributor
cjonesy
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: How can I create a ui with my code for 2.1

I'm so excited by these answers!

 

But im so sorry that i need one final bit of help probably due to my lack of c++ knowledge.

 

base operand of '->' has non-pointer type 'std2::mywindow' is the error for

 

screen_get_window_property_cv((screen_window_t)window->winId(), SCREEN_PROPERTY_GROUP, &screen_win);

 

and trying this way the other way 

const char * const groupNameData = static_cast<const char *>(nativeInterface->nativeResourceForWidget("windowGroup", window));

 

gives an error 

 

invalid use of incomplete type 'struct QPlatformNativeInterface

 

I just want to report back success!

 

 

 

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: How can I create a ui with my code for 2.1

(screen_window_t)(window->winId())   is probably what I meant to say.

 

as for the other, sounds like you're missing an include which defines class QPlatformNativeInterface{ ... };

Please use plain text.
Trusted Contributor
cjonesy
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: How can I create a ui with my code for 2.1

Even though im pretty sure both of you have provided me with the answer to my long struggle figuring out how to link the 2 screens - i still cant implement neither of the approaches. 

 

I have just tried with various approaches ranging from showing screen before doing nativeResourceForWidget and after this call. Neither work - I end up with debugger highlighting the line nativeResourceForWidget.

 

I notice nativeResourceForWidget needs a top level widget, I tried changing mywindow to a QWidget instead of QMainWindow but moc starting throwing errors so reverted back in case I could just pass window.topLevelWidget as initially hoped.

 

I'll post the start of the main function in case it help s someone help me with what i hope is a simple issue now compared to the rest of the problems the community has helped me solve.

 

QCoreApplication::addLibraryPath("app/native/lib");
		QApplication app(argc, argv);
		mywindow window;
		window.resize(500, 500);
		QPalette pal = window.palette();
		pal.setColor(QPalette::Window, Qt::red);
		window.setPalette(pal);
		window.setMaximumHeight(300);

		QPlatformNativeInterface * const nativeInterface =  QApplication::platformNativeInterface();
		const char * const groupNameData = static_cast<const char *>(
		        nativeInterface->nativeResourceForWidget("windowGroup", window.topLevelWidget()));
		//const QString groupName = QString::fromLatin1(groupNameData);

		window.show();
		

 

Please use plain text.
Trusted Contributor
cjonesy
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: How can I create a ui with my code for 2.1

[ Edited ]

I also tried with your approach Sean but I just couldnt get past the compiler, I did already do what you suggested before you posted again but I think you might have missed it. The error is 

 

Multiple markers at this line
- at this point in file
- invalid conversion from '_screen_window**'
to 'int'

 

I didnt understand &dest - was that an int?

 

//screen_win is a native screen
screen_get_window_property_cv((screen_window_t)window.winId(), SCREEN_PROPERTY_GROUP, &screen_win);

 

and trying with ->windId results in compiler error #

base operand of '->' has non-pointer type 'std2::mywindow'

Please use plain text.
Trusted Contributor
cjonesy
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: How can I create a ui with my code for 2.1

native window over qt window - yes!

 

char test[200];
screen_get_window_property_cv((screen_window_t)window.winId(), SCREEN_PROPERTY_GROUP, 199, test);

 

I still cant do it the proper way though because of it just closing so if anyone can tell me why after looking at my attempt  using nativeResourceForWidget then that will be great.

 

Next, videos frames over qt screen!

Please use plain text.
Trusted Contributor
cjonesy
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: How can I create a ui with my code for 2.1

I have now been searching around all day for a way to show some buttons using qt over the video which is being displayed in the native window, this native window is over the top of a qtmainwindow.

 

Any suggestions?

Please use plain text.
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: How can I create a ui with my code for 2.1

Do you still have the z index at like 10? Try lowering that to 0 or -1.

Please use plain text.
Trusted Contributor
cjonesy
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: How can I create a ui with my code for 2.1

good suggestion mreed. 

 

I set it to -1 in a swipe down event and the video dissapears. I'm assuming it's now just a matter of adding the buttons on to the behind screen and setting its transparency so the video is shown below the buttons. Hope its that straight forward!

 

Cant thank you enough for your help.

 

C

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: How can I create a ui with my code for 2.1

mcguire,

the only thing we can get usin nativeResourceForWidget is native window group, how do we get native screen context Qt is using?

Please use plain text.