[Qgis-developer] plugin text streams and Vector File writers
sailmcm at yahoo.com
Tue Apr 19 03:36:12 EDT 2011
I am pluging QGIS on Windows XP using Visual Studio 2008 compiler. I was able to set the user interface of my choice by using QTDesigner. I getting very comfortable and may be even getting hooked with QGIS. If QGIS fails then my research also fails. Such is the stake for me I am looking forward to the new release.
I need help with layer writers ( QgsVectorFileWriter) and stream writers (QTextStream). I know one is QGIS and the other QT. But you guys are expert in both and may help resolve my problems. I want to tackle the QT problem first, I open the text file pointer using the code below (almost the code of the tutorial by Marco.)
QString fileName = QFileDialog::getSaveFileName(0,"Traffic Stress log file name");
if(!f.open(QFile::WriteOnly | QFile::Truncate))
QMessageBox::information(0, "error", "Could not open file", QMessageBox::Ok);
I see the file created and yet when I try to write text data out I have not been successful at all. I have stream commands, such as the one below, thrown is at places I want to check the program's progress. They do compile without raising any errors and I also have message boxes with the variables come up during execution of the plugin, but nothing is being written to the disk file.
txtStream <<" Traffic Stress update "<<qsNetlayerName<<endl;
The compilation is working with out an error message. Yet not a single character is written to the file. I added the flush command as in
Yet nothing is being written. What am I missing?
I have other challenges that I have to overcome with the QgsVectorFileWriter also.
It has been very unpredictable with how the data is being written out. I am not sure if it is possible to run the plugin in debug mode on the Windows platform, but that may help newbie QGIS programmers like myself. But it may be too much to ask considering the work that all of you guys have already done. yet, I am asking it may already be possible to run a plugin in debug mode. Is it?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer