you have to do it like this..
//header
class basicLoop
: public QWidget,
private Ui
::looperDLG{
private:
static QTextEdit* te;
//name it different than ui header public:
}
//cpp
#include <QtGui>
#include "looper.h"
bool stop;
void mainLoop();
QTextEdit* basicLoop
::te=0;
//MUST do it here globaly...
basicLoop
::basicLoop(QWidget *parent
) {
setupUi(this); // this sets up GUI
te= textEdit//This textEdit is inherited from ui header
}
{
return te;
}
//header
class basicLoop : public QWidget, private Ui::looperDLG
{
private:
static QTextEdit* te;//name it different than ui header
public:
static QTextEdit* getTextEdit();
}
//cpp
#include <QtGui>
#include "looper.h"
bool stop;
void mainLoop();
QTextEdit* basicLoop::te=0;//MUST do it here globaly...
basicLoop::basicLoop(QWidget *parent)
{
setupUi(this); // this sets up GUI
te= textEdit//This textEdit is inherited from ui header
}
QTextEdit* basicLoop::gettextEdit()
{
return te;
}
To copy to clipboard, switch view to plain text mode
now you can call the basicloop::gettextEdit() in your mainloop()...
this is not the best solution.. coz this assumes that you are using only single instance of basicloop... becoz everytime a new object of basicloop is created the textedit will change.. if you only use one instance of basicloop.. make it a singleton class.
Bookmarks