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

Author Topic: QT with SFML clean resizing in OSX  (Read 888 times)

0 Members and 1 Guest are viewing this topic.

NightShadeI

  • Newbie
  • *
  • Posts: 7
    • View Profile
QT with SFML clean resizing in OSX
« on: January 15, 2023, 02:59:06 am »
Hi, I have managed to successfully integrate QT with SFML using the various tutorials out there.

Unfortunately resizing doesn't work as expected. It only does once the mouse button is released. Let me be clear, in a pure SFML window (no QT), I don't have this issue. Neither do I have it in Windows. This only fails in OSX

The behaviour is when decreasing the QT window size, SFML will shrink its window by too much, leaving surrounding black spaces. When increasing it will over compensate, and stretch the SFML inner window too much.

Again, the window resizes correctly when the mouse button is released.

Some possible reasons/ factors that might play into this:

- I don't call pollEvent() at all, due to this not working on SFML prior to 2.6.0
- I have a high DPI resolution display. I know SFML doesn't support this, so as a workaround, I multiply the size in set size by devicePixelRatio provided by QT (2), on my windows device this is 1
- I call set size on every resize event, this is necessary since SFML isnt seeing the resize event and for the DPI issues mentioned above

Any insight on workarounds would be infinitely appreciated, thanks

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: QT with SFML clean resizing in OSX
« Reply #1 on: January 17, 2023, 01:18:26 pm »
It's unlikely that someone just knows off the cuff what the problem is, given that we don't know how you exactly integrated SFML and Qt and doing such an integration is a rather edge case not many people employ.

If you use Qt already, couldn't you just use Qt's capabilities to render some basic 2D shapes, textures, etc.?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/