roxton
25th December 2008, 16:17
Hello!
I have two windows - the main one and the secondary window (an image viewer). Here is a code demostrating how I show the image viewer window:
if (! img_viewer->window.isVisible()) //if the viewer is not visible
{
img_viewer->window.show();
activateWindow(); //trying to set focus back to the main window
}
img_viewer->set_image (full_path); //just show an image
//at the QLabel
So the focus works in the following way:
1. When the image viewer window became visible (after the show() method), the focus moves to this image viewer window.
2. But I want to get the focus back into the main window. So I call activateWindow().
3. Nothing happens. The focus stays on the image viewer window.
I have two windows - the main one and the secondary window (an image viewer). Here is a code demostrating how I show the image viewer window:
if (! img_viewer->window.isVisible()) //if the viewer is not visible
{
img_viewer->window.show();
activateWindow(); //trying to set focus back to the main window
}
img_viewer->set_image (full_path); //just show an image
//at the QLabel
So the focus works in the following way:
1. When the image viewer window became visible (after the show() method), the focus moves to this image viewer window.
2. But I want to get the focus back into the main window. So I call activateWindow().
3. Nothing happens. The focus stays on the image viewer window.