Ich möchte mir den status auf der statusBar ausgeben, das signal wird auch gesendet, aber die Nachricht erscheint nicht auf der statusBar.
Hat jemand ne Idee?
Die Thread Klasse:
Code: Alles auswählen
#include <QThread>
#include "v24tools.h"
class myThread: public QThread
{
Q_OBJECT
public:
myThread(QObject *parent = 0);
~myThread();
void communicate();
public slots:
void starteInit();
protected:
void run();
private:
QString text;
int status;
signals:
void statusSenden(const QString &text);
};
Code: Alles auswählen
void myThread::starteInit()
{
if(0 == status)
{
char tempText[100];
sprintf(tempText, "status1");
text = tempText;
emit statusSenden(text);
status = 1;
this->start();
}
}
Code: Alles auswählen
ui.setupUi(this);
thread1 = new myThread();
QObject::connect(thread1 , SIGNAL(statusSenden(const QString &)), ui.statusBar, SLOT(messageChanged(const QString &)));