Results 1 to 2 of 2

Thread: QObjectList porting problem

  1. #1
    Join Date
    Jun 2008
    Posts
    64
    Thanks
    7
    Qt products
    Qt3 Qt4

    Default QObjectList porting problem

    From QT3 to QT4, QObjectList should have changed.
    How can I convert the following QT3 code to QT4?

    Qt Code:
    1. QObjectList *l = this->queryList( "TableButton" ); // get all its children which is TableButton
    2. QObjectListIt it( *l ); // iterate over the buttons
    3.  
    4. while ( it.current() != 0 )
    5. {
    6. // for each found button...
    7. ((TableButton *)(it.current()))->close( TRUE );
    8. ++it;
    9. }
    10. delete l;
    To copy to clipboard, switch view to plain text mode 

    Thanks!

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QObjectList porting problem

    Qt Code:
    1. foreach(TableButton *tb, findChildren<TableButton*>())
    2. tb->close(TRUE);
    To copy to clipboard, switch view to plain text mode 

    Shorter than before, right?

    HTH

Similar Threads

  1. Weird problem while porting from Qt3 to Qt4
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 07:51
  2. Font Problem Porting from Windows to Linux
    By rajeshs in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2007, 10:25
  3. Problem related to porting from QT3 to QT4 in list items
    By rohitjun in forum Qt Programming
    Replies: 5
    Last Post: 1st June 2007, 09:05
  4. Problem porting Kivio MP on win32 from Qt 3 to Qt 4
    By Amanda in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2006, 19:40
  5. Problem in porting Main window on linux
    By jyoti kumar in forum Qt Tools
    Replies: 2
    Last Post: 2nd June 2006, 08:35

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.