Hello,
I am attempting to create a GUI control for use in future Qt applications. Part of it involves repeated calls of a function, while the mouse is down.
My control consists of a class "control" based on QWidget.
Within this there is another class "myqslider" which is a subclassed QAbstractSlider.
Within "myqslider" I have a slot "timeout()" which is meant to be called whenever the timer times out.
In the constructor for "myqslider" I have:
QObject::connect(internal_timer,
SIGNAL(timeout
()),
this,
SLOT(timeout
()));
QTimer* internal_timer = new QTimer(this);
QObject::connect(internal_timer,SIGNAL(timeout()),this,SLOT(timeout()));
To copy to clipboard, switch view to plain text mode
Whenever I run my application I get the following:
QObject: Cannot create children for a parent that is in a different thread. (Parent is myqslider(0x3966f0), parent's thread is QThread(0xb35b30), current thread is QThread(0x3969e0).
I am completely stumped. As far as I can tell every QObject has its own thread, and pretty much everything in Qt is based off of QObject so I dont think its a case of it being too "low in the chain" (i've tried putting it in the constructor for "control" anyway).
Does anyone have any ideas?
Thanks!
Bookmarks