Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML and Qt5  (Read 3822 times)

0 Members and 1 Guest are viewing this topic.

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
SFML and Qt5
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML and Qt5
« Reply #1 on: February 11, 2013, 07:56:46 am »
On which OS?
Laurent Gomila - SFML developer

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML and Qt5
« Reply #2 on: February 11, 2013, 05:09:42 pm »
Hi Laurent, Windows 7 & 8 that is.

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML and Qt5
« Reply #3 on: February 13, 2013, 04:17:40 am »
Any hint would be welcome!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11007
    • View Profile
    • development blog
    • Email
Re: SFML and Qt5
« Reply #4 on: February 13, 2013, 04:21:15 am »
From this thread.

Quote from: Laurent
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).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML and Qt5
« Reply #5 on: February 14, 2013, 10:47:36 pm »
Oh, thank you very much for your inputs eXpl0it3r;

I'll try the:
setFocusPolicy(Qt::StrongFocus);

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML and Qt5
« Reply #6 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?

 

anything