Saturday, 15 March 2014

qt - ui is protected, but how to use it in the reimplemented Qthread run() function -



qt - ui is protected, but how to use it in the reimplemented Qthread run() function -

i want reemplement run function creating own class of qthread.

i've created this,

class mythread : public qthread { public: void run(); }; void mythread::run() { gui w; w.listen_device(w.ui->combobox->currentindex()); exec(); }

i can't utilize qpaint outside main thread i'm giving value argument listen_device function.

i know ui gui protected, how can value?

thanks.

create public method in gui class homecoming ui->combobox->currentindex();

public: int gui::getcurrentindex() // or whatever { homecoming ui->combobox->currentindex(); }

and don't subclass qthread, utilize movetothread() on qobject instead.

qt user-interface qthread

No comments:

Post a Comment