Results 1 to 4 of 4

Thread: Can't see any text append in UI?

  1. #1
    Join Date
    Oct 2007
    Posts
    32
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Can't see any text append in UI?

    I got a problem to use the QTextEdit with append function.
    Qt Code:
    1. MainWindow::ui->textDumpMessage->append("Before the QStringList fileList line");
    2. QStringList fileList = QFileDialog::getOpenFileNames(this, tr("Open CSV"), QDir::currentPath(), tr("CSV File *.csv"));
    3. if (fileList.isEmpty())
    4. {
    5. return false;
    6. }
    7. MainWindow::ui->textDumpMessage->append("After the QStringList fileList line");
    8. qDebug() << "Load csv";
    To copy to clipboard, switch view to plain text mode 

    the QTextEdit can show first append text but fail to get the second append text. I doubt the problem is on QStringList or QFileDialog. Does any body encounter the same issue?

    I use QT 4.7.2 with mingw32 on windows XP.

  2. #2
    Join Date
    Apr 2011
    Posts
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can't see any text append in UI?

    Hi, try inserting a new append inside the isEmpty() check, so that you can know whether the execution gets there: i.e:

    Qt Code:
    1. MainWindow::ui->textDumpMessage->append("Before the QStringList fileList line");
    2. QStringList fileList = QFileDialog::getOpenFileNames(this, tr("Open CSV"), QDir::currentPath(), tr("CSV File *.csv"));
    3. if (fileList.isEmpty())
    4. {
    5. MainWindow::ui->textDumpMessage->append("File is Empty");
    6. return false;
    7. }
    8. MainWindow::ui->textDumpMessage->append("After the QStringList fileList line");
    9. qDebug() << "Load csv";
    To copy to clipboard, switch view to plain text mode 

    Notice the new line I have added before return false;.
    Now tell us what happens then.

  3. #3
    Join Date
    Oct 2007
    Posts
    32
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't see any text append in UI?

    Hello,

    I insert the line as you describe. Here is the result
    1. If I select file or files, I still can't get the second text append in QTextEdit. qDebug work as usual. The program still runs.
    2. If I don't select the file, I can get the "File is Empty" append in QTextEdit.

    Any comment? welcome.


    Added after 1 54 minutes:


    Some new finding...

    If the function is finished. The all append text can be shown on the QTextEdit. In other word, if the "QStringList" object (fileList in this case) is destoryed, I can get all update to QTextEdit. Why? does QStringList queues all the message passing to UI? how can I solved this problem. I have to use QStringList.
    Last edited by SamT; 9th April 2011 at 11:17.

  4. #4
    Join Date
    Oct 2007
    Posts
    32
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't see any text append in UI?

    I got some new finding on this Keeping_the_GUI_ResponsiveMaybe I need to use different thread to keep the GUI responsive.

Similar Threads

  1. QTextEdit doesn't append text
    By Luc4 in forum Qt Programming
    Replies: 7
    Last Post: 13th June 2010, 23:45
  2. Append to a XML Document
    By Goldmmbr in forum Qt Programming
    Replies: 0
    Last Post: 16th November 2009, 16:03
  3. how to append text in label
    By wagmare in forum Qt Programming
    Replies: 3
    Last Post: 12th March 2009, 12:06
  4. Cannot append to QFile using QIODevice::Append
    By philwinder in forum Qt Programming
    Replies: 4
    Last Post: 17th November 2008, 10:09
  5. QVector - Append
    By krishbhala in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2007, 11:50

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.