How to change speed or sensitivity mouse cursor in Qt - qt

I wanna change the sensitivity of the cursor in the Qt project e.g. MouseArea. I found QMouseDevice or MouseDevice (in QML) for the 3D environment, these have sensitivity property. But I could not find a smooth example for that.
I test by using SPI_SETMOUSESPEED, with Qt v5.14 and MSVCx64 2017 compiler. But cannot handle that. This page of github has some suggestions and I can't solve my prob.

Related

Drawing with EGL in Qt

I'm trying to get Qt and EGL to work together. I'm working on a program that uses EGL to draw, and I have to use Qt to create a GUI overlay.
The current solution was to turn a QWidget into a native window, and pass it's window handle to EGL. This works, but it's difficult to work with. Qt isn't aware that the widget is being drawn in by something else. So when another widget is overlaid, even if it's transparent, the image drawn by EGL is erased. The only way to get them to work is if I jigsaw the buttons and other GUI elements in a way that they don't overlap the parts of the native window I want to show. However this means that I can't use layouts or QML or any of the tools that would make creating different GUIs easy.
So my question is, how can I draw with EGL into Qt in a more usable way.
I'm working with Qt 5.4.2 by the way. If absolutely necessary, I might be able to upgrade to 5.5, but newer versions won't work.
I was looking into QOpenGLContext, and ways to make it use the context created by EGL, but I can't seem to find any good examples on how to actually go about doing this.

How do I enable HiDPI (Retina) support in a Qt4 OpenGL application?

I am using a QGraphicsScene with a QGraphicsView, as described in this document. I intend to eventually overlay Qt widgets on top of my OpenGL rendered scene.
When I launch a dummy application modeled after the tutorial above, the rendered view is heavily pixelated-- HiDPI isn't working at all. Per this document, I've manually added:
<key>NSHighResolutionCapable</key>
<string>True</string>
to the application's Info.plist file, still with no effect. (It seems this is supposed to default to true anyway, so maybe that's not surprising).
Beyond the above, I haven't found what's needed to get HiDPI working. I am not using QtCreator, and my Qt install is macports' qt4-mac. What am I missing?
Qt5 enables HiDPI for the OpenGL context, but not for widgets and QGraphicsItems.
According to this bug, support for rendering widgets and QGraphicsItems on a QGLWidget in HiDPI is not yet supported; they will render at standard res and be resized.
QGraphicsView will render in HiDPI if it has an ordinary QWidget to back it. If it is possible to achieve the desired effect using QGraphicsItems without OpenGL, this may be preferable until HiDPI support is improved.
I just found the solution: run your program with --graphicssystem native. Or if you can alter the sources you can use QApplication::setGraphicsSystem("native");.

How do I design a native looking OS X application preferences with Qt?

Other than trying to manually, re-write everything to mimic the tooblar graphics and the size transition animation when moving between pages, Is there a better way to do this?
Amazingly I can't find ANY resources covering this, or even someone asking for this.
http://qt-project.org/doc/qt-5.1/qtwidgets/qtwidgets-index.html#styles
The window animations may already work as is... You may want to specify Native Windowing, so that the Mac Windowing system is aware of your Qt windows:
http://qt-project.org/doc/qt-5.1/qtwidgets/qwidget.html#native-widgets-vs-alien-widgets
Native Widgets vs Alien Widgets
Introduced in Qt 4.4, alien widgets
are widgets unknown to the windowing system. They do not have a native
window handle associated with them. This feature significantly speeds
up widget painting, resizing, and removes flicker. Should you require
the old behavior with native windows, you can choose one of the
following options:
Use the QT_USE_NATIVE_WINDOWS=1 in your
environment.
Set the Qt::AA_NativeWindows attribute on your
application. All widgets will be native widgets.
Set the
Qt::WA_NativeWindow attribute on widgets: The widget itself and all of
its ancestors will become native (unless
Qt::WA_DontCreateNativeAncestors is set).
Call QWidget::winId to
enforce a native window (this implies 3).
Set the Qt::WA_PaintOnScreen
attribute to enforce a native window (this implies 3).
See also
QEvent, QPainter, QGridLayout, and QBoxLayout.
And this link has more information on the styling in Qt than I have ever seen before today!
http://qt-project.org/doc/qt-5.1/qtwidgets/style-reference.html
Hope that helps.

Live Webcam + Shader effects

I want to create an application which basically captures a webcam feed and applies a custom shader effect on it, for Windows. I could use GLSL, HLSL, any shader language really.
I've tried to use Qt, which has some very nice examples with QML and Qt Mobility, but unfortunately, it doesn't capture my webcam at all! And I didn't really find any solution to my problem. I'm using Windows 7 64-bit.
So my question is: what tools should I use to build a simple app for this quickly? languages, APIs, any tip is kindly welcome!
I would use OpenCV to capture the image from the WebCam and D3D or OpenGL to create a texture form the captured image. Here is an example.
Afterwards, I would draw a full-screen quad with the texture where you can apply your shader effects.
OpenCV can be easily built with CMake or you can download a prebuild version.

Qt+OpenGl+SimpleGl

I have enabled qt+OpenGl+SimpleGl on one of the ARM platform and was able to run opengl example programs.
I also has a qt+Webkit, which is working with a graphic plugin.
I wanted to use simpleGl context for every thing, instead of using the normal graphic screen. So, when I try to run Qt+Webkit with simpleGl, I just get a blank screen.
Does QT support this? If so how can we make it?
Yes, this is correct. OpenGL draws directly to the framebuffer. The simplegl driver doesn't handle what is drawn using the raster paint engine of the QWS, so you may see only black.
Using simplegl for "everything" means you want everything to be drawn using OpenGL in your EGL full-screen window? This is possible under some assumptions. You have to write all your applications to be rendered using the Qt OpenGL paint engine (using the opengl graphics system is not supported under Qt/E). This is possible also for QtWebKit, I'm doing it now. Note that this does not mean that everything is rendered using hardware acceleration. You'll have to write your applications "the right way" to get all actually hardware accelerated. Consider that you'll have to handle the mouse pointer some other way in this case.
The other way is to just modify the simplegl driver to allow for the use of Qt applications using the raster paint engine. This is possible as well with some limitations. Qt can use blit to place its own windows over OpenGL. Look for the framebuffer driver inside the Qt source tree to know how to do this. You can then have common Qt applications and OpenGL Qt applications some way. I'm doing this as well. Not everything can be done anyway.
EDIT: I'm sure you already did, but in case, give this http://doc.qt.io/qt-4.8/qt-embeddedlinux-opengl.html much attention.
Unfortunately I don't know anything about SimpleGL, but I do know that there is a way to render a standard Qt widget in a QGLWidget. Maybe have a look at this Qt Quarterly which I think is somewhat related to your question:
http://doc.qt.nokia.com/qq/qq26-openglcanvas.html

Resources