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

Author Topic: QSFMLCanvas in QTabWidget : flickering  (Read 2459 times)

0 Members and 1 Guest are viewing this topic.

Yohdu

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
QSFMLCanvas in QTabWidget : flickering
« on: August 25, 2016, 09:47:52 am »
Hello,

In order to implement (or try at least) a map editor using Qt and SFML, I implemented the QSFMLCanvas as described in the tutorial http://www.sfml-dev.org/tutorials/1.6/graphics-qt.php and http://becomingindiedev.blogspot.fr/2013/10/qt-5-and-sfml-20-integration.html (for sfml 2.X integration). It works well when I use it in a simple container.

But now I would like the user to be able to open several maps at the same time, using tabs. So I simply have a QTabWidget in which I add the opened qsfmlcanvas. Each time I open one, a have a small flickering effect just when the qsfmlcanvas appears. I also have this flickering effect sometimes when I change tab, here again when the qsfmlcanvas appears.

It is not a "big" problem, but still it's quite ugly and it hurts my eyes each time i open a new map.

I know it may not ne a pure SFML problem, but it is also not a pure Qt problem, so here I am... Do you have any idea of what may cause this flickering, and how to fix it ?

Thank you in advance :)

korczurekk

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
Re: QSFMLCanvas in QTabWidget : flickering
« Reply #1 on: August 25, 2016, 10:46:04 am »
Maybe it's garbage in video memory displayed before first
window.display()
is called? Try something like that:
window.clear({0, 0, 0});
window.display();
 
And run it when widget is being created.

Yohdu

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: QSFMLCanvas in QTabWidget : flickering
« Reply #2 on: August 25, 2016, 10:51:44 am »
Thank you for your answer. Unfortunately, I already tried (and I just tested it again) this, but it does not change anything :s

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: QSFMLCanvas in QTabWidget : flickering
« Reply #3 on: August 25, 2016, 10:57:04 am »
Could you upload a short video to show what this flickering looks like?

If you increase the frameTime argument (of the QSFMLCanvas constructor), does it affect the flickering?
Laurent Gomila - SFML developer

Yohdu

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: QSFMLCanvas in QTabWidget : flickering
« Reply #4 on: August 25, 2016, 11:20:25 am »
Sure, here is a link to dl a video showing the flickering problem : http://crz.se/7102
If needed, here is a link to dl the project as-is : http://crz.se/7101

I tried changing the frametime argument but it doesnt seem to change anything

 

anything