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

Author Topic: [Qt + SFML] Resize Qt main frame does nothing on SFML window  (Read 1198 times)

0 Members and 1 Guest are viewing this topic.

larta

  • Newbie
  • *
  • Posts: 4
    • View Profile
[Qt + SFML] Resize Qt main frame does nothing on SFML window
« on: February 06, 2014, 10:48:26 am »
Hi all
I'm actually having a problem. I use SFML 2.1 with Qt 5.

The problem is that i can't resize my SFML view. Let me explain :
When using only sfml, resizing the window change the window content size and position naturally.

But when using Qt, resizing the qt main frame does nothing on the sfml view (That the natural behavior, i know).
So i wanted to catch the resize event to resize the sfml view.
Well, what happend is not what i expected.

I can catch the resize event and give it to my sfml widget using an event filter. But i can't resize correctly the sfml window. I tried to put a view inside the window, then call setSize() on the view (and setView() on the window) but it doesn't change the actual window size.
It just change the inside view size, making my sprites smaller, but their position doesn't change.

To be clearer, i made a small project illustrating what i'm saying.
It just draw something on the screen. When resizing the window, the content should move and be resized, depending on the size of the main qt frame.

Link in attachement.
(I copy/pasted my project code and removed some things, just don't care about useless commented code x))
(It's just the basic Sfml + Qt code + some other things (and the event filter))

To sum up, i want to reproduce the resizing behavior of a sfml window, inside an sfml frame. That's to say, do something like calling a "native_resize" function on the sfml window.

Hope you can help me.
Thanks
(Edit : I forgot to say the project runs on Linux)


(Edit2 : Looks like i'm stupid.
This morning, right after poster i saw a post talking about a "setSize()" function on a sf::RenderWindow. Well, i didn't see this, and that actually works. Sorry, this post is now useless. It may be useless for other, who knows .. x))
« Last Edit: February 06, 2014, 11:03:03 am by larta »