Results 1 to 3 of 3

Thread: QTreeWidgetItemIterator

  1. #1
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTreeWidgetItemIterator

    Hello anybody

    I look for information for QTreeWidgetItemIterator on the net but i didn't found anything this item.
    It is new in QT-4.1 but no documentation.

    I want to save a file with saveFile(const QString &fileName).
    see code:
    Qt Code:
    1. void MainWindow::saveFile(const QString &fileName)
    2. {
    3.  
    4. QFile file( fileName );
    5. if ( !file.open(QFile::WriteOnly))
    6. return;
    7.  
    8. QTextStream out( &file );
    9. QTreeWidgetItemIterator it( contactView );
    10. for( ; it.current(); ++it )
    11. for ( unsigned int i = 0; i < 3; i++ )
    12. out << it.current()->text( i) << "\n";
    13. file.close();
    14.  
    15. }
    To copy to clipboard, switch view to plain text mode 

    The compiler complains over this errors.
    mainwindow.cpp: In member function ‘void MainWindow::saveFile(const QString&)’:
    /usr/local/Trolltech/Qt-4.1.0-rc1/include/QtGui/qtreewidgetitemiterator.h:86: fout: ‘QTreeWidgetItem* QTreeWidgetItemIterator::current’ is protected
    mainwindow.cpp:139: fout: within this context
    mainwindow.cpp:139: fout: ‘it.QTreeWidgetItemIterator::current’ cannot be used as a function
    /usr/local/Trolltech/Qt-4.1.0-rc1/include/QtGui/qtreewidgetitemiterator.h:86: fout: ‘QTreeWidgetItem* QTreeWidgetItemIterator::current’ is protected
    mainwindow.cpp:141: fout: within this context
    mainwindow.cpp:141: fout: ‘it.QTreeWidgetItemIterator::current’ cannot be used as a function
    Where can i find documentation for QTreeWidgetItemIterator.

  2. #2
    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

  3. #3
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeWidgetItemIterator

    Thanks wysota it works fine now.

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.