PDA

View Full Version : QTreeWidgetItemIterator



dragon
22nd January 2006, 12:13
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:


void MainWindow::saveFile(const QString &fileName)
{

QFile file( fileName );
if ( !file.open(QFile::WriteOnly))
return;

QTextStream out( &file );
QTreeWidgetItemIterator it( contactView );
for( ; it.current(); ++it )
for ( unsigned int i = 0; i < 3; i++ )
out << it.current()->text( i) << "\n";
file.close();

}


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.

wysota
22nd January 2006, 12:43
http://www.qtcentre.org/forum/showthread.php?t=230

dragon
22nd January 2006, 13:52
Thanks wysota it works fine now.