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
yalnte
Posts: 44
Registered: ‎06-16-2012
My Device: BB10 Dev Alpha
Accepted Solution

Qt Close Window Problem

[ Edited ]

Hi,

 

I have a problem closing Qt QMainwindows on BB10 / Dev Alpha. I have a parent QMainwindow which creates a child QMainwindow which is opened, used to set some user options, then closed (I'd like to close but not destroy the window if possible).

 

The window is created as follows::

 

gW_Options = new COptions(this);
gW_Options->showFullScreen();

 and closed by a button on it's form:

 

void COptions::on_pbClose_clicked()
{
	this->close();
}

This works on the Nokia N9 / N900 (screen disappears and user sees the parent window), but on the Dev Alpha the child window remains on screen and accepts no further input.

 

Does anyone have any suggestions please? Should I only have one QMainwindow? Do I need to convert this child window to a Dialog instead?

 

Note: I'd rather not create the window with Qt::WA_DeleteOnClose set as it's useful to have the window hidden for reuse later.

 

Thanks,

Tom

 

Edit: I've tried various other options including: showMinimized(); hide(); parent->raise(); parent->showFullScreen() but no luck yet.

----------------------------------------------------------------------------------
Blog: http://partialpivot.blogspot.co.uk/
Please use plain text.
BlackBerry Development Advisor
lingBB10Dev
Posts: 35
Registered: ‎08-01-2012
My Device: BB10 alpha-BB10 developer
My Carrier: T-Mobile

Re: Qt Close Window Problem

My quick tests were inline with what you reported. I did not have chance to find the root cause yet; it is likely we have a different message loop on BB10 from Nokia.

 

However, I found the followings was a workaround for me.

 

in the child mainwindow:

if I call

 this->hide();

and 

parent->raise();

 

together, it will bring the parent window to foreground and hide the child window.

 

can u try if this is true for you as well?

 

 

 

Please use plain text.
Developer
yalnte
Posts: 44
Registered: ‎06-16-2012
My Device: BB10 Dev Alpha

Re: Qt Close Window Problem

Hi,

 

Thanks - I tried this and no luck yet:

 

	this->hide();
	this->parentWidget()->raise();

I'm going to try a few more variations on this theme.

 

 

----------------------------------------------------------------------------------
Blog: http://partialpivot.blogspot.co.uk/
Please use plain text.
Developer
yalnte
Posts: 44
Registered: ‎06-16-2012
My Device: BB10 Dev Alpha

Re: Qt Close Window Problem

Hi, has anyone else seen please? Are there any examples where it does work?
Thanks & regards
----------------------------------------------------------------------------------
Blog: http://partialpivot.blogspot.co.uk/
Please use plain text.
BlackBerry Development Advisor
lingBB10Dev
Posts: 35
Registered: ‎08-01-2012
My Device: BB10 alpha-BB10 developer
My Carrier: T-Mobile

Re: Qt Close Window Problem

Can you share some of your code how the "parent" window was created, and how the "child" window was created?

 

As the code mentioned in my previous post was able to hide/show the child window in my case, probably the way of creating child window in your code made a difference?

 

Please use plain text.
Developer
yalnte
Posts: 44
Registered: ‎06-16-2012
My Device: BB10 Dev Alpha

Re: Qt Close Window Problem

OK, thanks will do. Not able to do much for a couple of days but will post next week.
----------------------------------------------------------------------------------
Blog: http://partialpivot.blogspot.co.uk/
Please use plain text.
Developer
yalnte
Posts: 44
Registered: ‎06-16-2012
My Device: BB10 Dev Alpha

Re: Qt Close Window Problem

[ Edited ]

Hi,

 

It looks like the cause of this problem was the showFullScreen() method. I was opening the window as follows:

 

   gW_FEMView = new CGUI_FEVMob(this);
   gW_FEMView->setAttribute(Qt::WA_DeleteOnClose,false);
   gW_FEMView->showFullScreen();

 but now open it using:

 

   gW_FEMView = new CGUI_FEVMob(this);
   gW_FEMView->setAttribute(Qt::WA_DeleteOnClose,false);
   gW_FEMView->show();

 To close the window I am using:

 

   (*this).hide();
   this->parentWidget()->activateWindow();

My next job is to get the windows to open fullscreen (either maximised or hardcoded I guess). But at least I don't get the app hanging any more :smileyhappy:)

----------------------------------------------------------------------------------
Blog: http://partialpivot.blogspot.co.uk/
Please use plain text.