nbkhwjm
1st October 2008, 22:25
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
#include "extlogwindow.h"
#include "ui_extlogwindow.h"
#include <QDebug>
#include <QSettings>
ExtLogWindow::ExtLogWindow(QWidget *parent) : QDialog(parent)
{
ui.setupUi(this);
// THIS WORKS OK
ui.logWindowTextEdit->setText(tr("this is text"));
// ABOVE WORKS OK
qDebug() << "This is logwindow.cpp";
}
ExtLogWindow::~ExtLogWindow()
{
}
void ExtLogWindow::updateLogWindow(QString &entry)
{
qDebug() << "Logwindow.cpp Logentry" << entry;
// THESE DO NOT WRITE DATA
ui.logWindowTextEdit->setText(tr("this is text #2"));
ui.logWindowTextEdit->append(tr("TTT%1").arg(entry));
// ABOVE DO NOT WORK
}
extlogwindow.h
#include "extlogwindow.h"
#include "ui_extlogwindow.h"
#include <QDebug>
#include <QSettings>
#include <QTextEdit>
ExtLogWindow::ExtLogWindow(QWidget *parent) : QDialog(parent)
{
ui.setupUi(this);
// THIS WORKS OK
ui.logWindowTextEdit->setText(tr("This entry is from the top"));
// ABOVE WORKS OK
qDebug() << "This is logwindow.cpp";
}
ExtLogWindow::~ExtLogWindow()
{
}
void ExtLogWindow::updateLogWindow(QString &entry)
{
qDebug() << "Logwindow.cpp Logentry" << entry;
// THIS DOES NOT WRITE DATA
ui.logWindowTextEdit->append(tr("LOG: %1").arg(entry));
}
The code produces the following on the command line: When I call:
Where "entry" = "test"
ExtLogWindow logger(this);
logger.updateLogWindow(entry);
Command line output
This is logwindow.cpp
Logwindow.cpp Logentry "This entry is from the top"
Logwindow.cpp Logentry "test"
The following shows up in Texedit window
This entry is from the top
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?
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
#include "extlogwindow.h"
#include "ui_extlogwindow.h"
#include <QDebug>
#include <QSettings>
ExtLogWindow::ExtLogWindow(QWidget *parent) : QDialog(parent)
{
ui.setupUi(this);
// THIS WORKS OK
ui.logWindowTextEdit->setText(tr("this is text"));
// ABOVE WORKS OK
qDebug() << "This is logwindow.cpp";
}
ExtLogWindow::~ExtLogWindow()
{
}
void ExtLogWindow::updateLogWindow(QString &entry)
{
qDebug() << "Logwindow.cpp Logentry" << entry;
// THESE DO NOT WRITE DATA
ui.logWindowTextEdit->setText(tr("this is text #2"));
ui.logWindowTextEdit->append(tr("TTT%1").arg(entry));
// ABOVE DO NOT WORK
}
extlogwindow.h
#include "extlogwindow.h"
#include "ui_extlogwindow.h"
#include <QDebug>
#include <QSettings>
#include <QTextEdit>
ExtLogWindow::ExtLogWindow(QWidget *parent) : QDialog(parent)
{
ui.setupUi(this);
// THIS WORKS OK
ui.logWindowTextEdit->setText(tr("This entry is from the top"));
// ABOVE WORKS OK
qDebug() << "This is logwindow.cpp";
}
ExtLogWindow::~ExtLogWindow()
{
}
void ExtLogWindow::updateLogWindow(QString &entry)
{
qDebug() << "Logwindow.cpp Logentry" << entry;
// THIS DOES NOT WRITE DATA
ui.logWindowTextEdit->append(tr("LOG: %1").arg(entry));
}
The code produces the following on the command line: When I call:
Where "entry" = "test"
ExtLogWindow logger(this);
logger.updateLogWindow(entry);
Command line output
This is logwindow.cpp
Logwindow.cpp Logentry "This entry is from the top"
Logwindow.cpp Logentry "test"
The following shows up in Texedit window
This entry is from the top
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?