I'm in a ArchLinux with OpenBox and I want to hide the cursor on fullscreen inside a Qt 4.8 application. I am aware about some other question about it but no one works every time: sometimes the cursor is hiding, sometimes not. I didn't managed to understand exactly when the problem occurs but I think that maybe is it related with the screensaver because if I test my application just after the computer is restarted the mouse cursor is no visible (and it is what I want) but if I test this feature during the day the mouse cursor is still visible in fullscreen.
This is my code:
void MainWindow::toggleFullScreen()
{
if(!this->isFullScreen())
{
this->showFullScreen();
#ifdef Q_WS_QWS
QWSServer::setCursorVisible( false );
#endif
}
else
{
this->showNormal();
}
}
I want to hide the cursor on fullscreen ...
You could set the cursor to be the blank cursor:
widget->setCursor(Qt::BlankCursor);
Also, as the docs state:
Some underlying window implementations will reset the cursor if it leaves a widget even if the mouse is grabbed. If you want to have a cursor set for all widgets, even when outside the window, consider QApplication::setOverrideCursor().
So you can call:
QApplication::setOverrideCursor(Qt::BlankCursor);
There is a program named unclutter that hides the mouse pointer. Here's an ArchLinux package:
https://www.archlinux.org/packages/community/i686/unclutter/
I currently use it on an embedded system for hiding the mouse cursor on a touchscreen.
Related
I am trying to use mouse cursor in Qt5 application.
When I run ./Qt5_CinematicExperience :
Failed to move cursor on screen HDMI1: -14
Could not set cursor on screen HDMI1: -6
There is no mouse cursor displayed on the screen.
Same results with another Qt5 application.
The click event seems to be working.
I am using Yocto rocko on kernel 4.14.24.
Do you think Qt5 needs a specific library to use mouse?
My mouse is present as input device in /dev/input/.
A cat command on /dev/input/event1 displays a lot of characters when I move the mouse.
Check if you have this line in your QT_QPA_EGLFS_KMS_CONFIG:
"hwcursor" : false
The problem isn't with the input device at all: it clearly works. It has to do with the cursor - the thing that you see on-screen that represents the position of the mouse. I'd guess that Qt tries to be clever about how it displays the cursor - as Groleo said, very likely the hardware or the drivers doen't support a hardware-accelerated mouse cursor.
You could easily see that the mouse works by implementing the mouse cursor yourself :)
I'm running Qt 5.5.1 on my embedded Linux machine. When a mouse is connected the cursor is visible and work as expected, but, when I'm pressing on a widget to move to another screen the new screen is presented with the old screen view inside a small square (mouse background at the time of the press). Example:
It seems like it's a rendering issue. Your help is most welcome.
I am working on a touchscreen GUI for an embedded Linux device that will sit over a video feed. Therefore, I need my GUI to be transparent and disappear after some timeout so the user can just view the video feed. The main.cpp of my GUI ensures that the background of the entire application running with the -qws option is transparent with the following code:
QApplication a(argc, argv, QApplication::GuiServer);
QWSServer::instance()->setBackground(QBrush(Qt::NoBrush));
QWSServer::setCursorVisible (false);
I have a main, bottom level widget that owns every other widget in the GUI. I set the background to transparent with the following pallete related code.
QPalette transparentPallete;
transparentPallete.setColor(QPalette::Window, Qt::transparent);
setAutoFillBackground(true);
setPalette(transparentPallete);
I also overrode the paintEvent method to try to ensure that the background would always be in a clean transparent state:
void MainWidget::paintEvent(QPaintEvent *event)
{
QPainter p(this);
// Fill background
p.setPen(Qt::NoPen); // no outlines
p.fillRect(0,0,width(),height(),QColor(255, 255, 255, 0)); // Fill rectangle with color
}
Now I can launch my application and view my GUI over the raw video feed and I can interact by touch to bring up different windows within the GUI and have them disappear.
What I cannot accomplish is to get rid of artifacts that are left behind when I hit 'cancel' or order certain portions of the GUI to disappear. These artifacts look really ugly ( multiple vertical lines / wrong colors ) and only disappear when another part of the GUI is summoned that replaces that location on the screen. They are there regardless of whether I have the video feed enabled ( which lives on a different overlay controlled by the processor dss anyway ).
How can I get rid of these artifacts that are left behind after dismissing some widgets?
NOTE: This definetly is correlated with the following line:
QWSServer::instance()->setBackground(QBrush(Qt::NoBrush)); // Allows transparent pixels to be written to frame buffer
If I turn this line off, I cannot see the underlying overlay but I also do not get any strange behavior whatsoever and my performance becomes much better. How can I achieve transparency but also lose the strange artifacts?
Well the following has an issue apparently:
QWSServer::instance()->setBackground(QBrush(Qt::NoBrush));
But this solves the problem and I see 0 artifacts:
QWSServer::setBackground(QBrush(QColor(0, 0, 0, 0)));
the issue we are facing is that the mouse cursor disappears when a user is using the app in a safari on MAC. The app UI is in flex 4actionscript running in the flash player.
So whenever the cursor hovers over an HDividedBox draggable divider the cursor changes and on returning to the advanced data grid it disappears.
We thought of replacing that with a custom cursor written in javascript, which would have been worked, but we also have an iframe embedded in the flash movie.
The custom javascript cursor listens for mousemove in the parent div holding the swf and updates its position however the JS script is not usable as the user hovers over an iframe and it does not bubble up the mouse move event.
Looking for an alternate solution now.
I set a custom cursor using the CursorManager on a sprite's mouse down event.
The custom cursor is shown. However, when I keep the mouse pressed the system cursor shows as well and is flickering.
Any idea how to prevent this?
I've tried:
- higher cursor priorities
- preventing the default in the mouse down event
nothing seems to work.
Changing the cursor just on mouse over works fine.
Thanks
Stefan
PS:
- Safari on Mac
- Flash debug player 10.0.2.54