LordQt
1st December 2008, 11:34
Hello friends,
how can I access my QTexEdit from another class or from a Thread.
thr_startReadTrackFile = new readTrackFile(selectedFile, bodyEdit);
thr_startReadTrackFile->start();
when I append a line to the TextEdit in my Thread I have an Error .....
my Thread declaration looks like
//************************************************** ************************
class readTrackFile : public QThread
//************************************************** ************************
{
Q_OBJECT
public:
readTrackFile(const QString &p_inFile,
QTextEdit *p_bodyEditCopy,
QObject* parent = 0);
virtual ~readTrackFile() { }
public slots:
protected:
void run();
private:
QString qstr_inFile;
QTextEdit* bodyEditCopy;
and in the implemantion
void readTrackFile::run()
{
...
QFile inFile(qstr_inFile);
QString qstr_textLine;
if(inFile.exists() )
{
if (inFile.open(QFile::ReadOnly | QFile::Text) )
{
QTextStream filestream( &inFile );
...
while (!filestream.atEnd())
{
qstr_textLine = filestream.readLine();
if(qstr_textLine.count(";",Qt::CaseInsensitive)== 36)
{
bodyEditCopy->append(qstr_textLine);
...
}
else
{
...
...
...
}
}
}
}
inFile.close();
}
Could anybody see the misunderstanding from my side....
how can I access my QTexEdit from another class or from a Thread.
thr_startReadTrackFile = new readTrackFile(selectedFile, bodyEdit);
thr_startReadTrackFile->start();
when I append a line to the TextEdit in my Thread I have an Error .....
my Thread declaration looks like
//************************************************** ************************
class readTrackFile : public QThread
//************************************************** ************************
{
Q_OBJECT
public:
readTrackFile(const QString &p_inFile,
QTextEdit *p_bodyEditCopy,
QObject* parent = 0);
virtual ~readTrackFile() { }
public slots:
protected:
void run();
private:
QString qstr_inFile;
QTextEdit* bodyEditCopy;
and in the implemantion
void readTrackFile::run()
{
...
QFile inFile(qstr_inFile);
QString qstr_textLine;
if(inFile.exists() )
{
if (inFile.open(QFile::ReadOnly | QFile::Text) )
{
QTextStream filestream( &inFile );
...
while (!filestream.atEnd())
{
qstr_textLine = filestream.readLine();
if(qstr_textLine.count(";",Qt::CaseInsensitive)== 36)
{
bodyEditCopy->append(qstr_textLine);
...
}
else
{
...
...
...
}
}
}
}
inFile.close();
}
Could anybody see the misunderstanding from my side....