PDA

View Full Version : How to create a child widget, linked and of a different size?



Pembar
6th May 2009, 17:02
I currently have a widget of a certain size, say 100x100. I'd like to be able to use it to create another widget of size 150x40, linked.

When I say "linked", I mean, if possible,

1. When I close the main widget, the child widget should close too.
2. The two widgets should appear as only one "application".

I'll need the two widgets to be portable, meaning, they may have to be located in different parts of the screen.

If anyone has winamp, that's something what I had in mind. A main winamp window and a playlist window. They both appear as one program but if you close the main winamp window, the playlist window closes as well.

Thanks in advance

Regards,
Pembar

Lykurg
6th May 2009, 18:13
For your main window use QMainWindow and for the play list simply lunch a QDialog (non modular!) from "inside" the mainwindow. Than you will have your effects.

(Since I am not sure if the dialog will close automatically you can also overdrive the closeEvent of the main window and close there you play list)

aamer4yu
6th May 2009, 22:04
A main winamp window and a playlist window. They both appear as one program but if you close the main winamp window, the playlist window closes as well.
That must be easy... you override the close event for main widnow, and call qApp->quit(); from there. On close event for other windows(playlist) you just hide them , simple, isnt it ??
or am i missing something :confused:

wysota
7th May 2009, 00:07
Also moveEvent of one window has to cause the other one to be moved (using QWidget::move()) as well (the "link" feature).

Pembar
7th May 2009, 10:59
Thanks for the replies guys.


Also moveEvent of one window has to cause the other one to be moved (using QWidget::move()) as well (the "link" feature).

In particular, I was wondering, could you elaborate on the "link" feature? Or a website link would help too.

Thanks much.

Regards,
Pembar

wysota
7th May 2009, 11:00
In particular, I was wondering, could you elaborate on the "link" feature? Or a website link would help too.

What exactly do you want to know?

Pembar
7th May 2009, 14:24
What exactly do you want to know?


When you were talking about the "link" feature, you mean the linking in between windows within winamp?

In hopes of it being ez-mode, I thought you meant there was a function buried somewhere to link the two windows easily.

I'm currently working on linking the two windows (i.e. when you move the main window, the childwindow moves along with it) by modifying the eventfilters.

Regards,
Pembar

wysota
7th May 2009, 14:29
When you were talking about the "link" feature, you mean the linking in between windows within winamp?
I meant that if one window moves, the other moves with it. That's what I understood by your "link" term.


In hopes of it being ez-mode, I thought you meant there was a function buried somewhere to link the two windows easily.
From application's point of view windows are independant. It is the window manager that may control groupping them. What you are trying to do now is to work around the window manager.

Pembar
7th May 2009, 14:38
Yup. Thanks.

I got them to move together!!! =)

Regards,
Pembar