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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - daijin12

Pages: [1]
1
I seems to work well! Thank you!!

2
Hello everyone,

I have a problem to integrate a SFML renderwindow inside a Qt widget, since the new SFML 2.4 is released.
The problem happens only on my linux (on windows everything's fine).

My config :
 - Ubuntu 16.04
 - Qt 5.7.0
 - gcc 6.1.1 (tried with 5.3 and 4.9)
 - SFML 2.4 from github up to date

It seems that sf::RenderWindow::create(winId());  "create" an infinite loop...
The result is a Qt widget with a transparent inside...

Looking a bit more inside the SFML code, it appears that it comes from the lines 927 and 928 of the file src/SFML/Window/Unix/WindowImplX11.cpp in the function setVisible(bool visible):

void WindowImplX11::setVisible(bool visible)
{
    if (visible)
    {
        .........
        .........

        // Before continuing, make sure the WM has
        // internally marked the window as viewable
        while (!m_windowMapped)
            processEvents();
    }
 


Removing this while loop solves the problem.

I put in attachments a simplest code reproducing the bug.

If you've any idea of what's going on, please let me now.

Cheers,
daijin12


3
Hi,

I finally solved this, by updating SFML from the git repository.

I now works quite well but still need to reimplement resizeEvent function
void QSFMLCanvas::resizeEvent(QResizeEvent *event)
{
    setSize(sf::Vector2u(event->size().width(),event->size().height()));
}

It works well for both Fedora and Windows.

4
Window / [Solved] [Qt5+SFML2.1] Resizing a SFML canvas in a QLayout
« on: November 28, 2013, 02:42:38 am »
Hello everyone,

I have a problem in a program using SFML 2.1 integrated in a Qt5 interface.
I placed the QSFMLCanvas in the layout of a QStackedWidget itself inserted into the centralwidget of a QMainWindow:
 
Sfml = new QSFMLCanvas(this);
   
widget_container = new QStackedWidget(this);
widget_container->addWidget(Sfml);
widget_container->setCurrentWidget(Sfml);
widget_container->layout()->setAlignment(widget_container,Qt::AlignCenter);
setCentralWidget(widget_container);
 

It works fine under Linux (Fedora 18), the canvas is well resized with the QMainWindow.

By cons, under Windows 7, the canvas keeps it original size and is positioned at the bottom left when you resize the QMainWindow.

I tried to see what was happening by printing the size of the QWidget and of the RenderWindow which are the parent classes of QSFMLCanvas in the resizeEvent() function:
void QSFMLCanvas::resizeEvent(QResizeEvent *event)
{
    std::cout << size().width() <<" " << size().height()
              <<  " " << getSize().x << " " << getSize().y <<  std::endl;
}
 

and here is an example of the output:
815 639 700 579
815 639 700 579
825 641 700 579
825 641 700 579
835 644 700 579
835 644 700 579
842 646 700 579

RenderWindow size does not vary while the QWidget is well resized.

I tried to add a setSize() in the resizeEvent() function but it does not change anything:
void QSFMLCanvas::resizeEvent(QResizeEvent *event)
{
    setSize(sf::Vector2u(event->size().width(),event->size().height()));
   
        std::cout << size().width() <<" " << size().height()
              <<  " " << getSize().x << " " << getSize().y <<  std::endl;
}
 

If someone has an idea to fix that, it would help me a lot.

Thank you in advance and sorry if my english is bad,

daijin12

5
General discussions / Re: RedHat/Fedora packages for SFML
« on: August 06, 2013, 05:14:39 pm »
Ok, thanks.
I think I will wait for the official Fedora packages.
For now, I use compiled by myself libs, but it will be great to just have to do a simple "yum update" instead of : "cd Sfmldirectory ; git pull; make ; sudo make install;"
 ;)

6
General discussions / Re: RedHat/Fedora packages for SFML
« on: August 06, 2013, 03:19:59 pm »
Oh, I just have little question.
I'm a Fedora 18 users (I will upgrade when my work will allow me to do it) and I don't know why, my yum does just see your packages for Fedora 19.
Of course, I can directly download the packages I want and install theim manually, but it's a bit strange, no?

7
General discussions / Re: RedHat/Fedora packages for SFML
« on: August 06, 2013, 03:02:59 pm »
Hi,
it's a great work!!  :) Thank you from all Fedora/RedHat users.

8
Window / Re: Window resizing + Qt
« on: December 26, 2012, 02:21:48 am »
Hi!

I have almost the same problem here. I update SFML today while looking at this topic in order to see if it changes anything, but no changes.

I'm runing on Fedora 17 and the same things appears for me but not all the time. Most of the time, the SFMLCanvas behaves correctly when resizing the widget parent (here I put SFMLCanvas in the central layout of a QMainWindow), but somethimes and especially when I use a lot of CPU with other software at the same time, the bug as describe here appears at he software execution.

The problem disappears using Windows 7.

I'm not an expert of X11 and Qt as Cide is, so I can't say more on that topic. Do you progress a little about that?

Merry Christmas

PS : Sorry for my bad english but I'm french so I do what I can.


Pages: [1]