Re: [Interest] QWindow::setTransientParent fails on windows

2013-09-27 Thread Roland Winklmeier
Hi Tony,

thanks for your answer.

I'm giving you a little more background:
I have an application which offers the possibility to enhance it via
plugins/addons. I'm developing such an addon which also has its own window.
I of course want to have my application to be the child of the main
application, because otherwise it looks ugly and also the sound output of
the main application stops as soon as it looses focus.

I tried what you said, but I still have some points which are not met with
this approach. I have the requirements:
- if the main application has focus, the child window is always in front
- only one entry in the tab bar (this is fulfilled)
- if I minimize the main application, my child window should be minimized
as well

In the mean time I found some other weird stuff. I did some tests with QML
windows:

ApplicationWindow {
id: mainWindow
title: My MainWindow
width: 640
height: 480

Button {
text: Child
onClicked: childWindow.visible = !childWindow.visible
}

Window {
id: childWindow
visible: true
}
}

childWindow should have the parent mainWindow from the beginning. But it
isnt. I have to manually set the visibility to false and open it via the
button or close and open it with the button. Doing this will change it to
act like a proper child window. I guess this is a bug in Qt.

 setTransientParent still doesn't do anything at all. Maybe both issues are
related, I don't know.


2013/9/26 Tony Rietwyk t...@rightsoft.com.au

 Hi Roland, 

 ** **

 I'm not sure what you are trying to achieve,  but I had a similar problem
 with the splash screen appearing with its own task bar tab.   I worked
 around the problem by doing:

 ** **

   int exstyle = GetWindowLong( mpSplash-winId(), GWL_EXSTYLE );

   SetWindowLong( mpSplash-winId(), GWL_EXSTYLE, 

 exstyle  ~WS_EX_TOOLWINDOW );

 ** **

 before showing the splash.  

 ** **

 Hope that helps, 

 ** **

 Tony

 ** **

 ** **

 *From:* interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:
 interest-bounces+tony=rightsoft.com...@qt-project.org] *On Behalf Of *Roland
 Winklmeier
 *Sent:* Thursday, 26 September 2013 2:34 AM
 *To:* interest@qt-project.org
 *Subject:* [Interest] QWindow::setTransientParent fails on windows

 ** **

 Hi there,

 I'm currently struggling with QWindow::setTransientParent on a windows
 platform. I have two different windows and want to set one as the child of
 the other. Using QWindow::setParent() was not successful, because it was
 embedded into the parent (I got the parent QWindow* by calling fromWinID() )

 If I call QWindow::setTransientParent(parent), nothing changes. I have two
 different entries in the taskbar instead of one and both windows are still
 parentless.
 After looking into the code in the windows platform plugin, I found out
 that the following method is called in qwindowswindow.cpp:

 void QWindowsWindow::updateTransientParent() const.

 This method sets the parent by setting GWL_HWNDPARENT. But MSDN explicitly
 said, you should NOT do it this way:

 You must not call SetWindowLong with the GWL_HWNDPARENT index to change
 the parent of a child window. Instead, use the SetParent function. 
 Source:
 http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%29.aspx
 

 So I assume this should be changed in the windows platform plugin to be a
 real parent? Are there any other options to set the parent without
 embedding it?

 Cheers

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QWindow::setTransientParent fails on windows

2013-09-27 Thread Rutledge Shawn

On 27 Sep 2013, at 10:50 AM, Roland Winklmeier wrote:
 In the mean time I found some other weird stuff. I did some tests with QML 
 windows:
 
 ApplicationWindow {
 id: mainWindow
 title: My MainWindow
 width: 640
 height: 480
 
 Button {
 text: Child
 onClicked: childWindow.visible = !childWindow.visible
 }
 
 Window {
 id: childWindow
 visible: true
 }
 }
 
 childWindow should have the parent mainWindow from the beginning. But it 
 isnt. I have to manually set the visibility to false and open it via the 
 button or close and open it with the button. Doing this will change it to act 
 like a proper child window. I guess this is a bug in Qt.

These kinds of problems are because of initialization order: the inner window 
is created (and made visible, because it's declared that way) before the outer 
one is, so it cannot become transient for the outer window.  Hopefully we can 
invent a real fix for that, but in the mean time you can force the order in 
which they become visible by taking out any visible: true declarations and 
adding this to the outer window:

Component.onCompleted: { mainWindow.visible = true; childWindow.visible = true }

Or as you say, the user can initiate showing the transient window.  A transient 
popup dialog is usually a response to something the user did, or something that 
happened asynchronously; but why would you write an app that interrupts you 
immediately with a transient popup before you do anything?  I was hoping such 
situations would be rare, except in writing test code to make sure that 
multiple windows work OK.  ;-)

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] QWindow::setTransientParent fails on windows

2013-09-25 Thread Roland Winklmeier
Hi there,

I'm currently struggling with QWindow::setTransientParent on a windows
platform. I have two different windows and want to set one as the child of
the other. Using QWindow::setParent() was not successful, because it was
embedded into the parent (I got the parent QWindow* by calling fromWinID() )

If I call QWindow::setTransientParent(parent), nothing changes. I have two
different entries in the taskbar instead of one and both windows are still
parentless.
After looking into the code in the windows platform plugin, I found out
that the following method is called in qwindowswindow.cpp:

void QWindowsWindow::updateTransientParent() const.

This method sets the parent by setting GWL_HWNDPARENT. But MSDN explicitly
said, you should NOT do it this way:

You must not call SetWindowLong with the GWL_HWNDPARENT index to change
the parent of a child window. Instead, use the SetParent function. 
Source:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%29.aspx

So I assume this should be changed in the windows platform plugin to be a
real parent? Are there any other options to set the parent without
embedding it?

Cheers
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QWindow::setTransientParent fails on windows

2013-09-25 Thread Tony Rietwyk
Hi Roland, 

 

I'm not sure what you are trying to achieve,  but I had a similar problem
with the splash screen appearing with its own task bar tab.   I worked
around the problem by doing:

 

  int exstyle = GetWindowLong( mpSplash-winId(), GWL_EXSTYLE );

  SetWindowLong( mpSplash-winId(), GWL_EXSTYLE, 

exstyle  ~WS_EX_TOOLWINDOW );

 

before showing the splash.  

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Roland Winklmeier
Sent: Thursday, 26 September 2013 2:34 AM
To: interest@qt-project.org
Subject: [Interest] QWindow::setTransientParent fails on windows

 

Hi there,

I'm currently struggling with QWindow::setTransientParent on a windows
platform. I have two different windows and want to set one as the child of
the other. Using QWindow::setParent() was not successful, because it was
embedded into the parent (I got the parent QWindow* by calling fromWinID() )

If I call QWindow::setTransientParent(parent), nothing changes. I have two
different entries in the taskbar instead of one and both windows are still
parentless.
After looking into the code in the windows platform plugin, I found out that
the following method is called in qwindowswindow.cpp:

void QWindowsWindow::updateTransientParent() const. 

This method sets the parent by setting GWL_HWNDPARENT. But MSDN explicitly
said, you should NOT do it this way:

You must not call SetWindowLong with the GWL_HWNDPARENT index to change the
parent of a child window. Instead, use the SetParent function. 
Source:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%2
9.aspx

So I assume this should be changed in the windows platform plugin to be a
real parent? Are there any other options to set the parent without embedding
it?

Cheers

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest