Results 1 to 7 of 7

Thread: problem with a list of pointers

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 29 Times in 27 Posts

    Default Re: problem with a list of pointers

    What about foreach ?
    Qt Code:
    1. foreach (QWidget *widget, list) {
    2. ...
    3. }
    To copy to clipboard, switch view to plain text mode 
    I'm a rebel in the S.D.G.

  2. #2
    Join Date
    Jun 2009
    Posts
    44
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with a list of pointers

    how can I use foreach?what does it do?

  3. #3
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 29 Times in 27 Posts

    Default Re: problem with a list of pointers

    Here is its description.
    I'm a rebel in the S.D.G.

  4. #4
    Join Date
    Jun 2009
    Posts
    44
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with a list of pointers

    but is i do with a foreach,i have the same problem.
    foreach (QWidget *widget, list) {
    v.at(0)->getScreenDirectionlist(&list);
    }

    What I need is to link my pointers of the widget that I have got, with the whole list in a for. this1->getScreenDirectionlist(&list); but with a for to make shorter the code.

  5. #5
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 29 Times in 27 Posts

    Default Re: problem with a list of pointers

    No, you have to do this
    Qt Code:
    1. foreach (QWidget *widget, yourWidgetsList) {
    2. widget->getScreenDirectionlist(some_other_list);
    3. }
    To copy to clipboard, switch view to plain text mode 

    There is a little bit confusion about v and list. What are they for?
    I'm a rebel in the S.D.G.

Similar Threads

  1. Problem with list View
    By yuvaraj.yadav in forum Qt Programming
    Replies: 9
    Last Post: 29th April 2009, 14:02
  2. Replies: 1
    Last Post: 23rd April 2009, 09:05
  3. Replies: 19
    Last Post: 3rd April 2009, 23:17
  4. deployment problem: msvc++ 2008 Express, Qt 4.4.3
    By vonCZ in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2008, 14:38
  5. K&R's strcpy function - problem with pointers
    By jamadagni in forum General Programming
    Replies: 7
    Last Post: 8th January 2006, 15:16

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
  •  
Qt is a trademark of The Qt Company.