Results 1 to 5 of 5

Thread: Porting Qt3->Qt4 QListIterator

  1. #1
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Porting Qt3->Qt4 QListIterator

    Hi!

    I have trouble porting code from qt3 to qt4.

    Qt Code:
    1. int i = m_pWorkspace->windowList().find( m_pWorkspace->activeWindow()).indexof;
    2. //error C2440: 'initializing' : cannot convert from 'QList<T>::iterator' to 'int'
    3.  
    4. QWidget* w = m_pWorkspace->windowList().at( ++i );
    5. if ( w ) w->setFocus();
    To copy to clipboard, switch view to plain text mode 

    I don't know how to get an int index.

    Please help.

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Porting Qt3->Qt4 QListIterator

    Do you mean maybe:
    Qt Code:
    1. int i = m_pWorkspace->windowList().insexOf(m_pWorkspace->windowList().find( m_pWorkspace->activeWindow()));
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Porting Qt3->Qt4 QListIterator

    Thank you for your answer. yes, i meant something like this.
    but now it says:

    C2664: 'QList<T>::indexOf' : cannot convert parameter 1 from 'QList<T>::iterator' to 'QWidget *const &'

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Porting Qt3->Qt4 QListIterator

    and this?:
    Qt Code:
    1. int i = m_pWorkspace->windowList().insexOf(*m_pWorkspace->windowList().find( m_pWorkspace->activeWindow()));
    To copy to clipboard, switch view to plain text mode 

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

    kemp (3rd October 2006)

  6. #5
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Porting Qt3->Qt4 QListIterator

    Thank you very much, now it works fine.

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.