Hiho,
I’m programming a game and want to display a menu if the player hits F1 and hide the menu again if Esc is hitten.
The problem is that the game crashes as soon as I invoke menuFrame->show() or setShown(true).
I think the reason is that I call the function in the game thread and not in the mainthread.
Since I only have two choices:
Call the function in the game mainloop if a variable gets true
or
from a slot bound on the F1 key
I dont know how to show or hide this frame.
In some Posts on various forums I read that I have to call postevent for manipulate widgets outside the main thread.
The problem is that I don’t know how to do that, and I didn’t find any examples on showing / hiding widgets with postevent.
Can somebody point me to the right direction or maybe provide a little code snippet so that I know how to use postevent for showing / hiding a widget?
Thanks in advence and have a nice day
Ritschratsch
↧