PDA

View Full Version : How to make popup window exactly cover application window?



TheNewGuy
10th December 2009, 05:51
I have a popup window (with a transparent background). I want this window to be the same size as the primary application which calls it and be in the same position (so it covers the application window). Does anyone know how to do that?

Also, if possible, do you know how to get the current position of the cursor relative to the window that just popped up?

Here is how the process works:

main window -> user clicks -> widget pops up that covers the parent application window completely -> mouse coordinates are used to draw on the transparent widget that covers application window

spirit
10th December 2009, 06:13
I have a popup window (with a transparent background). I want this window to be the same size as the primary application which calls it and be in the same position (so it covers the application window). Does anyone know how to do that?

set this widget active using QApplication::setActiveWindow.



Also, if possible, do you know how to get the current position of the cursor relative to the window that just popped up?

Here is how the process works:

main window -> user clicks -> widget pops up that covers the parent application window completely -> mouse coordinates are used to draw on the transparent widget that covers application window

take a look at QCursor::pos, note: this method returns current global mouse coordinates, if you need to map coordinates to particular coordinate system you should use one of map-functions: QWidget::mapFromGlobal, QWidget::mapFromParent etc.

wagmare
10th December 2009, 07:01
I have a popup window (with a transparent background). I want this window to be the same size as the primary application which calls it and be in the same position (so it covers the application window). Does anyone know how to do that?
setting the primary application as parent to popup dialog
and
resize(parent->size());
will make the size of the window to parent size ..