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

Author Topic: Prevent SFML from changing cursor (when changed in Qt app)  (Read 3265 times)

0 Members and 1 Guest are viewing this topic.

Tenry

  • Full Member
  • ***
  • Posts: 120
  • Experienced Programmer
    • View Profile
    • Simon-Burchert.com
Prevent SFML from changing cursor (when changed in Qt app)
« on: August 26, 2011, 11:56:50 pm »
Hi, I'm currently writing a level editor, using Qt and SFML 1.6.

I use Qt to change the cursor, e.g. a resize cursor, but always when I'm moving my cursor, it is switching back to default cursor for a very short time, and I found out that it must be SFML's fault.

Is there any way to disable it? Or does SFML 1.6 include a feature to change the cursor?
Please note that my previous display name was "Shy Guy".

Alejandro

  • Newbie
  • *
  • Posts: 27
    • View Profile
Prevent SFML from changing cursor (when changed in Qt app)
« Reply #1 on: August 27, 2011, 08:44:01 am »
I use Qt and SFML together as well and compiling them for the first time I noticed this "feature" as well. As it may not seem to be pretty I just told sfml to hide the cursor and it pretty much gets the job done for me.
Code: [Select]

void sf::Window::ShowMouseCursor ( bool   Show )

Tenry

  • Full Member
  • ***
  • Posts: 120
  • Experienced Programmer
    • View Profile
    • Simon-Burchert.com
Prevent SFML from changing cursor (when changed in Qt app)
« Reply #2 on: August 27, 2011, 06:00:27 pm »
Quote from: "Alejandro"
I use Qt and SFML together as well and compiling them for the first time I noticed this "feature" as well. As it may not seem to be pretty I just told sfml to hide the cursor and it pretty much gets the job done for me.
Code: [Select]

void sf::Window::ShowMouseCursor ( bool   Show )

That's a good idea. But anyhow, it does not seem to work well if mouse button is down. Then, there just is no cursor.

Do you set the cursor by Qt on every frame, or only when the cursor is moved or needs to be changed?
Please note that my previous display name was "Shy Guy".

Alejandro

  • Newbie
  • *
  • Posts: 27
    • View Profile
Prevent SFML from changing cursor (when changed in Qt app)
« Reply #3 on: August 28, 2011, 07:09:06 am »
Actually since I don't use different cursors for different states, I just tell Qt when initializing the app to change the default cursor to an image I made and it stays like that the entire time, while the cursor is over the main window and it's elements:

Code: [Select]

QPixmap curImage("Data/GUI/Images/Cursor.png");
QCursor cur(curImage,0,0);
App->setOverrideCursor(cur);


If something isn't like it is in my application, it might be because I'm using SFML 2.0, but I don't think that might be a problem.

Tenry

  • Full Member
  • ***
  • Posts: 120
  • Experienced Programmer
    • View Profile
    • Simon-Burchert.com
Prevent SFML from changing cursor (when changed in Qt app)
« Reply #4 on: August 28, 2011, 06:24:53 pm »
Quote from: "Alejandro"
Actually since I don't use different cursors for different states, I just tell Qt when initializing the app to change the default cursor to an image I made and it stays like that the entire time, while the cursor is over the main window and it's elements:

Code: [Select]

QPixmap curImage("Data/GUI/Images/Cursor.png");
QCursor cur(curImage,0,0);
App->setOverrideCursor(cur);


If something isn't like it is in my application, it might be because I'm using SFML 2.0, but I don't think that might be a problem.

Hm, you are using setOverrideCursor() on the Application, whereas I am using setCursor() on my SFML widget. My editor has got other Qt widgets (buttons, inputs, etc) why I'm not overriding the overall cursor.

I don't think either that the SFML version difference is the reason.
Please note that my previous display name was "Shy Guy".

 

anything