Results 1 to 9 of 9

Thread: How to create a child widget, linked and of a different size?

  1. #1
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Red face 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

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default 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)

  3. The following user says thank you to Lykurg for this useful post:

    Pembar (7th May 2009)

  4. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create a child widget, linked and of a different size?

    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

  5. The following user says thank you to aamer4yu for this useful post:

    Pembar (7th May 2009)

  6. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. The following user says thank you to wysota for this useful post:

    Pembar (7th May 2009)

  8. #5
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to create a child widget, linked and of a different size?

    Thanks for the replies guys.

    Quote Originally Posted by wysota View Post
    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

  9. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to create a child widget, linked and of a different size?

    Quote Originally Posted by Pembar View Post
    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?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #7
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to create a child widget, linked and of a different size?

    Quote Originally Posted by wysota View Post
    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

  11. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to create a child widget, linked and of a different size?

    Quote Originally Posted by Pembar View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #9
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to create a child widget, linked and of a different size?

    Yup. Thanks.

    I got them to move together!!! =)

    Regards,
    Pembar

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.