PDA

View Full Version : Opening file



Salazaar
5th June 2007, 17:15
Hi. I've got a question. I want to load the file from a disk to a program. I looked in the book, and I've got there piece of code:


...
if (!spreadsheet->readFile(fileName))
...

But I don't have a spreadsheet, but this: I made a screen to let you take a precisely look at it.
http://allyoucanupload.webshots.com/v/2002776451403881452
How do I have to do


...
if (!spreadsheet->readFile(fileName))
...

in my case?

jpn
5th June 2007, 17:28
First of all, don't link screenshots to external sites. Who knows how long will they remain valid. Secondly, not to be rude but how on the earth are we supposed to help you when all we know about the background is a screenshot of the form? :)

Salazaar
5th June 2007, 17:40
Oh, ok, so as you see I have a QTabWidget and many lineEdits it each other. And I want to load text (to every lneEdit in which was a text) which I saved before to a disk. A bit clearer now? ;)

jpn
5th June 2007, 18:49
I would suggest using a QTableView (or QTableWidget) instead of so many QLineEdits. Anyway, there is no such "readFile()" available in Qt that would magically fill some arbitrary line edits with given text file. You just have to code things like this by yourself. Start with reading QFile and QTextStream docs how to read a text file.

Salazaar
5th June 2007, 19:04
readfile is my function, created myself. I'll look at the documentation

Salazaar
5th June 2007, 19:15
You're right, I'll do QTableWidget instead. Is spreadsheet QTableWidget too?