Results 1 to 4 of 4

Thread: TextEdit in QDialog not accepting data

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2007
    Posts
    59
    Thanks
    7

    Unhappy TextEdit in QDialog not accepting data

    now i been looking at this for two hours, hopefully someone will make me look bad here.

    I have a mainwindow that opens a Qdialog called ExtLogWindow, the window opens fine and I'm happy there.

    I send logging events to a function in ExtLogWindow that *should* write them to the Textedit window.

    extlogwindow.cpp

    Qt Code:
    1. #include "extlogwindow.h"
    2. #include "ui_extlogwindow.h"
    3. #include <QDebug>
    4. #include <QSettings>
    5.  
    6.  
    7. ExtLogWindow::ExtLogWindow(QWidget *parent) : QDialog(parent)
    8. {
    9.  
    10. ui.setupUi(this);
    11. // THIS WORKS OK
    12. ui.logWindowTextEdit->setText(tr("this is text"));
    13. // ABOVE WORKS OK
    14. qDebug() << "This is logwindow.cpp";
    15.  
    16. }
    17.  
    18. ExtLogWindow::~ExtLogWindow()
    19. {
    20.  
    21. }
    22.  
    23. void ExtLogWindow::updateLogWindow(QString &entry)
    24. {
    25.  
    26. qDebug() << "Logwindow.cpp Logentry" << entry;
    27. // THESE DO NOT WRITE DATA
    28. ui.logWindowTextEdit->setText(tr("this is text #2"));
    29. ui.logWindowTextEdit->append(tr("TTT%1").arg(entry));
    30. // ABOVE DO NOT WORK
    31.  
    32. }
    To copy to clipboard, switch view to plain text mode 

    extlogwindow.h
    Qt Code:
    1. #include "extlogwindow.h"
    2. #include "ui_extlogwindow.h"
    3. #include <QDebug>
    4. #include <QSettings>
    5. #include <QTextEdit>
    6.  
    7.  
    8. ExtLogWindow::ExtLogWindow(QWidget *parent) : QDialog(parent)
    9. {
    10.  
    11. ui.setupUi(this);
    12. // THIS WORKS OK
    13. ui.logWindowTextEdit->setText(tr("This entry is from the top"));
    14. // ABOVE WORKS OK
    15. qDebug() << "This is logwindow.cpp";
    16.  
    17. }
    18.  
    19. ExtLogWindow::~ExtLogWindow()
    20. {
    21.  
    22. }
    23.  
    24. void ExtLogWindow::updateLogWindow(QString &entry)
    25. {
    26.  
    27. qDebug() << "Logwindow.cpp Logentry" << entry;
    28.  
    29. // THIS DOES NOT WRITE DATA
    30. ui.logWindowTextEdit->append(tr("LOG: %1").arg(entry));
    31. }
    To copy to clipboard, switch view to plain text mode 

    The code produces the following on the command line: When I call:
    Where "entry" = "test"
    Qt Code:
    1. ExtLogWindow logger(this);
    2. logger.updateLogWindow(entry);
    To copy to clipboard, switch view to plain text mode 

    Command line output
    Qt Code:
    1. This is logwindow.cpp
    2. Logwindow.cpp Logentry "This entry is from the top"
    3. Logwindow.cpp Logentry "test"
    To copy to clipboard, switch view to plain text mode 

    The following shows up in Texedit window
    Qt Code:
    1. This entry is from the top
    To copy to clipboard, switch view to plain text mode 

    Any ideas? The variable "entry" is seen by the function or i would not get the command line output of "logwindow.cpp logentry "test"" Why does it not populate the data from the other function to QTextEdit?
    Last edited by nbkhwjm; 1st October 2008 at 22:26. Reason: spelling error

Similar Threads

  1. Clearing of data in TextEdit
    By keshab in forum Newbie
    Replies: 3
    Last Post: 15th December 2006, 11:29
  2. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 12:53

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
  •  
Qt is a trademark of The Qt Company.