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

Author Topic: Qt & SFML in 2.4  (Read 3355 times)

0 Members and 2 Guests are viewing this topic.

sb

  • Newbie
  • *
  • Posts: 22
    • View Profile
Qt & SFML in 2.4
« on: February 09, 2018, 05:57:29 pm »
Hello there.

I am afraid that this problem might be very difficult to solve because I can barely give you any information, but maybe you have got an idea on how to solve it.

Quite a while ago, I successfully managed to integrate SFML into Qt (see https://en.sfml-dev.org/forums/index.php?topic=19163.msg138596#msg138596 and https://github.com/SFML/SFML/blob/master/src/SFML/Window/Unix/WindowImplX11.cpp).

I did it on Windows (MinGW), SFML 2.3.2, but it also worked on linux (g++).

Currently, I am working on linux. I compiled SFML 2.4 for myself with Clang. Now, when I start my Qt/SFML application, as soon as the GUI shows up, I get the error message
Quote
Failed to create input context for window -- TextEntered event won't be able to return unicode
exactly once, while I have two QWidget/sf::RenderWindow elements.

Edit: Actually, I found out that this happens once for every second QWidget/sf::RenderWindow element I add, which is very odd (or rather: even).

The application continues to run
, however, the contents of those windows are not positioned correctly and the proportions are off. properly without any issues.

I tried debugging but I cannot find out at which point the problem arises. I think it is somehow triggered by Qt when it starts displaying the application gui. Still, I do not think I changed anything of the window creation process since I worked with the older SFML version, so I wonder if something in the new SFML version changed the behavior.

Unfortunately, I cannot provide any minimal example code (as I cannot narrow down the problem's origin), but I can show you my Qt/sf::RenderWindow implementation class, which I attach to this post.

I also welcome general ideas on when the error message mentioned above can occur.
« Last Edit: February 09, 2018, 07:39:12 pm by sb »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Qt & SFML in 2.4
« Reply #1 on: February 09, 2018, 06:23:59 pm »
Build in debug mode and check the expected values and actual values as well as when things are being changed.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

sb

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Qt & SFML in 2.4
« Reply #2 on: February 09, 2018, 07:40:38 pm »
Thank you for your reply.

I found that the wrong position / scale is a different issue not connected to the error message at all, sorry for that. I updated my original post.

The error implied by the message does not seem to have any effect.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Qt & SFML in 2.4
« Reply #3 on: February 09, 2018, 07:43:36 pm »
That much was clear already. My point still stands. Start a debugger and check what's going on, you know basic programming things. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

sb

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Qt & SFML in 2.4
« Reply #4 on: May 01, 2018, 12:44:36 pm »
It's been a while, but I could finally reproduce the problem with a minimal example. Minimal as in how minimal it can be with a qt application (requires moc to compile).

Failed to create input context for window -- TextEntered event won't be able to return unicode


comes up for every second canvas I create (in this example, I create four canvases in MainWindow::MainWindow()). Does not occur on Windows but on Ubuntu linux.

Any idea on this?

My point still stands. Start a debugger and check what's going on, you know basic programming things.

I can see that
m_inputMethod = XOpenIM(m_display, NULL, NULL, NULL);
in void WindowImplX11::initialize(), line 1267 of WindowImplX11.cpp seems not to be true when the error occurs, but I have no knowledge about those low level things. The circumstances of my own code are always the same.
« Last Edit: May 01, 2018, 01:00:26 pm by sb »