That is pretty nice idea (however it took some for me to seperate blocks of code and organize them in other way).
So now i have:
-class MainWindow (contains Draw member)
-class engine (resposible for some network data streaming and writing into files)
-class Draw (which inherits engine and QObject) - resposible for drawing and contains QGraphicsScene member.
Class Draw has SLOT: loop().
void Draw::loop()
{
while(1){
for(int a=0;a<200;a++){
for(int b=0;b<8;b++)inttab[b]=b;calculate();}
}
}
void Draw::loop()
{
while(1){
for(int a=0;a<200;a++){
for(int b=0;b<8;b++)inttab[b]=b;calculate();}
}
}
To copy to clipboard, switch view to plain text mode
MainWindow constructor contains this:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
grafika=new Draw();
connect(ui->actionStart,SIGNAL(triggered()),grafika,SLOT(loop())); // this line makes program terminated, why?
this->moveToThread(&watek); //there is a member QThread watek
//....etc.
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
grafika=new Draw();
connect(ui->actionStart,SIGNAL(triggered()),grafika,SLOT(loop())); // this line makes program terminated, why?
this->moveToThread(&watek); //there is a member QThread watek
//....etc.
}
To copy to clipboard, switch view to plain text mode
Bookmarks