PDA

View Full Version : Independant window in an application



titoo
28th February 2007, 10:41
I need to create for an application a window which can go out of the main window of the application. So I thought about creatin a widget with no parent. But I then have several problems :

¤ if I destroy the main window I still need to destroy the second window to stop the application,
¤ I have a box for this independant winodw in the systray,
¤ I need absolute coordinates of a UI widget of the main window to place the independant window but I only get relative coordinates atm

Is there an alternative way to do so, or do you know hoiw to avoid the problems I have ?
About destruction I figure how to do but I don't find the solution for the 2 other problems.

wysota
28th February 2007, 10:51
¤ if I destroy the main window I still need to destroy the second window to stop the application,
Delete the window from the other window's destructor.


¤ I have a box for this independant winodw in the systray,
Try setting the Qt::Tool window flag while creating the window.


¤ I need absolute coordinates of a UI widget of the main window to place the independant window but I only get relative coordinates atm
Use QWidget::mapToGlobal()


Is there an alternative way to do so, or do you know hoiw to avoid the problems I have ?
Depends what exactly is that you want to achieve.

titoo
28th February 2007, 10:59
well a windows son of the main windows should be ok but i need to get this window to be able to be partly or completely out of the main window and i think that inheritance will definitely not allow me to do this.

wysota
28th February 2007, 11:03
Have you tried this?

QMainWindow *mw = new QMainWindow;
QDialog dlg = new QDialog(mw);
mw->show();
dlg->show();

What inheritance are we talking about here?

titoo
28th February 2007, 11:07
looks like QDialog allows me to get the window out of the main window, sounds good ty