Results 1 to 3 of 3

Thread: Implicitly move child widgets *on their own.*

  1. #1
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Implicitly move child widgets *on their own.*

    I have a widget that (for example) wants to move child widgets without moving itself. It'd be grand if this were done without explicitly knowing the child. I.E. the widget A is a container and has a widget B placed into it (making B a child of A.) I wish to have widget B move when A.Event happens.

    It looks like in QObject the findChildren would work. I need a list of *all of the children.* So I assume I should pass a regular expression that allows everything; maybe:
    Qt Code:
    1. //formatted to separate the reg exp for you
    2. WidgetA->findChildren(
    3. QString([a-zA-Z0-9|_]*)
    4. )
    5. );
    To copy to clipboard, switch view to plain text mode 

    I guess I'm looking to verify that this is the correct idea and that the reg-exp is correct;
    Thanks for any help!

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,593
    Thanks
    13
    Thanked 1,587 Times in 1,516 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Implicitly move child widgets *on their own.*

    If you want all the children of a certain type then you pass nothing to the QObject::findChildren() function. If the object names of the objects you are interested in follow some known pattern then you could use a regular expression: your current expression matches most names.

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

    tescrin (8th August 2012)

  4. #3
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Implicitly move child widgets *on their own.*

    Thanks! I hadn't noticed the <T> in the function to specify type 'til you posted.

Similar Threads

  1. Child widgets
    By poporacer in forum Newbie
    Replies: 6
    Last Post: 12th August 2010, 03:04
  2. 2 QListWidget - move Entry between Widgets
    By reinki0013 in forum Qt Programming
    Replies: 5
    Last Post: 28th April 2010, 13:05
  3. Replies: 5
    Last Post: 18th April 2010, 23:31
  4. Child widget does not move along with its parent
    By starch in forum Qt Programming
    Replies: 8
    Last Post: 9th July 2009, 12:35
  5. setClipPath on child widgets.
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 27th May 2007, 19:12

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.