SFML community forums

Help => Window => Topic started by: golgoth on February 11, 2013, 03:17:27 am

Title: SFML and Qt5
Post by: golgoth on February 11, 2013, 03:17:27 am
Greetings everyone,

Im have the same issue as this fella:

Quote
I'm not sure. I'll just looked at the source of SFML, and this is what it looks like:
1.Qt creates the window
2.Qt gives me the HWND
3.I give SFML the HWND Window
4.SFML attaches it's own WndProc callback function to it, but saves the previous (Qt's) WndProc.
5.SFML receives the messages, processes them, then forwards them to the previous (Qt's) WndProc.

So it looks like SFML gets to process the Win32 events before Qt. I don't know why SFML is not processing the key presses (but is receiving mouse messages) then, but why it was previously with Qt 4.8.

Any idea what could cause SFML not to process the MouseButtonPressed anymore?
Title: Re: SFML and Qt5
Post by: Laurent on February 11, 2013, 07:56:46 am
On which OS?
Title: Re: SFML and Qt5
Post by: golgoth on February 11, 2013, 05:09:42 pm
Hi Laurent, Windows 7 & 8 that is.
Title: Re: SFML and Qt5
Post by: golgoth on February 13, 2013, 04:17:40 am
Any hint would be welcome!
Title: Re: SFML and Qt5
Post by: eXpl0it3r on February 13, 2013, 04:21:15 am
From this thread (http://en.sfml-dev.org/forums/index.php?topic=10599.0).

Quote from: Laurent (http://en.sfml-dev.org/forums/index.php?topic=10599.msg73096#msg73096)
It's known that events don't work 100% when SFML is embedded into another GUI framework. It depends on the GUI framework and on the OS, and I don't know exactly why. So the best solution in this case is to use the event system of the GUI framework.

Quote from: Foaly
But in Qt you have to call setFocusPolicy(Qt::StrongFocus); in order for keyPressed events to be passed to SFML (take a look at the 1.6 tutoria).
Title: Re: SFML and Qt5
Post by: golgoth on February 14, 2013, 10:47:36 pm
Oh, thank you very much for your inputs eXpl0it3r;

I'll try the:
setFocusPolicy(Qt::StrongFocus);
Title: Re: SFML and Qt5
Post by: golgoth on February 19, 2013, 09:55:38 pm
setFocusPolicy(Qt::StrongFocus) might have worked for SFML 1.6 but it does not work with version 2.0.

Any other idea what might prevent keyPressed events to be passed to SFML?