Results 1 to 4 of 4

Thread: Log File Question

  1. #1
    Join Date
    Aug 2009
    Posts
    16
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Log File Question

    All,

    I'm new to the boards and look to be a contributing member for quite some time as I have just landed an entry level job as a programmer using C++/QT.

    Anyways, my question is -- the program that I'm working on writes two different log files once programming has completed. I'm trying to develop a .ui inside the program that will enable the user to see the two logs in a widget screen where each tab on the screen will display the respected log?

    Does anyone have any ideas on how to accomplish this feat?

    Thanks so much

  2. #2
    Join Date
    Feb 2009
    Location
    Lexington, KY
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Log File Question

    You could create a QTabWidget with two tabs and a QTextEdit in each tab. When you are ready to read in the files, you can load them into the QTextEdits.

    You can set the QTextEdits to be read only, so that the user cannot type stuff into them. I think there are a few examples of QTextEdit linked from the QtAssitant help page.

    Bill.

  3. #3
    Join Date
    Aug 2009
    Posts
    16
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Log File Question

    Thanks Bill,

    I created my .ui with the two tabs and the text edit, however, I can't find a feasible way to read the data from the log file that is created to the .ui

  4. #4
    Join Date
    Feb 2009
    Location
    Lexington, KY
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Log File Question

    If the log file is short, you could just load the whole file into a string and use QTextEdit::append() to put it into the QTextEdit.

    I have not used QTextEdit's much, but it looks like you could assing it a QTextDocument, which you would load with QTextDocument::loadResource(). The URL for QTextDocument::loadResource() be a file URL with the path to your log file.

Similar Threads

  1. Read binary from file
    By weldpua2008 in forum Newbie
    Replies: 2
    Last Post: 3rd April 2009, 23:50
  2. qdirmodel question: show file number of a folder?
    By zl2k in forum Qt Programming
    Replies: 3
    Last Post: 7th November 2008, 07:07
  3. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  4. File packaging question
    By Bookmarc in forum General Programming
    Replies: 2
    Last Post: 4th December 2007, 10:09
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

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.