Results 1 to 6 of 6

Thread: Opening file

  1. #1
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Opening file

    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:
    Qt Code:
    1. ...
    2. if (!spreadsheet->readFile(fileName))
    3. ...
    To copy to clipboard, switch view to plain text mode 
    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/...76451403881452
    How do I have to do
    Qt Code:
    1. ...
    2. if (!spreadsheet->readFile(fileName))
    3. ...
    To copy to clipboard, switch view to plain text mode 
    in my case?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Opening file

    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?
    J-P Nurmi

  3. #3
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Opening file

    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?

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Opening file

    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.
    J-P Nurmi

  5. #5
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Opening file

    readfile is my function, created myself. I'll look at the documentation

  6. #6
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Opening file

    You're right, I'll do QTableWidget instead. Is spreadsheet QTableWidget too?

Similar Threads

  1. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 16:21
  2. Exclusive file creation (Samba shares)
    By marcel in forum General Programming
    Replies: 1
    Last Post: 13th April 2007, 13:26
  3. Sending Binary File with QFTP
    By nbkhwjm in forum Newbie
    Replies: 2
    Last Post: 7th March 2007, 19:10
  4. How to rename a file after opening ?
    By npc in forum Newbie
    Replies: 2
    Last Post: 1st June 2006, 14:36
  5. Opening swf file in the default browser
    By munna in forum Qt Programming
    Replies: 16
    Last Post: 5th May 2006, 10:33

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.