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>
{
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
}
#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
}
To copy to clipboard, switch view to plain text mode
extlogwindow.h
#include "extlogwindow.h"
#include "ui_extlogwindow.h"
#include <QDebug>
#include <QSettings>
#include <QTextEdit>
{
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));
}
#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));
}
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"
ExtLogWindow logger(this);
logger.updateLogWindow(entry);
ExtLogWindow logger(this);
logger.updateLogWindow(entry);
To copy to clipboard, switch view to plain text mode
Command line output
This is logwindow.cpp
Logwindow.cpp Logentry "This entry is from the top"
Logwindow.cpp Logentry "test"
This is logwindow.cpp
Logwindow.cpp Logentry "This entry is from the top"
Logwindow.cpp Logentry "test"
To copy to clipboard, switch view to plain text mode
The following shows up in Texedit window
This entry is from the top
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?
Bookmarks