How to create a child widget, linked and of a different size?
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
Re: How to create a child widget, linked and of a different size?
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)
Re: How to create a child widget, linked and of a different size?
Quote:
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:
Re: How to create a child widget, linked and of a different size?
Also moveEvent of one window has to cause the other one to be moved (using QWidget::move()) as well (the "link" feature).
Re: How to create a child widget, linked and of a different size?
Thanks for the replies guys.
Quote:
Originally Posted by
wysota
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
Re: How to create a child widget, linked and of a different size?
Quote:
Originally Posted by
Pembar
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?
Re: How to create a child widget, linked and of a different size?
Quote:
Originally Posted by
wysota
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
Re: How to create a child widget, linked and of a different size?
Quote:
Originally Posted by
Pembar
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.
Quote:
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.
Re: How to create a child widget, linked and of a different size?
Yup. Thanks.
I got them to move together!!! =)
Regards,
Pembar