Posts

Showing posts from February, 2014

Check if any key is pressed in Linux

Image
In case you would to know if a key (any key) is pressed in Windows it exist a very useful function called _kbhit() . Linux doesn't have a similar function but is possible to easily reproduce using a few lines of code. Nothing new since this kind of code is possible to find in many places around, it's just to give my little contribution by providing a ready made function to simply copy and past in your code.

Qt: wait for a signal in synchronously mode

Image
Qt libraries work using the mechanism called signal-slot. Basically this is a optimal way to make an asynchronous communication between objects in any kind of conditions and transmitting any kind of data. However, sometimes, may happen the need to wait for a very short time event (for example wait for the end of a short animation).