[Solved] Animation of cursor on touch
-
Did you check that the pixmap is valid ?
-
Thanks for answering. Yes, it is. While playing around I had a too large pixmap. It then did throw an error on the console.
Just found: To make it run I had to place a
QApplication::processEvents();
after the setOverrideCursor. This is probably only needed because I placed it in the MainWindow constructor for testing purpose. I will move it to the notify reimplementation where I catch the mouse and keyboard events and then would probably not need it.Is there a way to have at least a gray scaled or even colored cursor, maybe bigger than the current maximum of 64x64?
If not, I'll probably have to implement a workaround like showing a graphic for a short time at the location of the touch/click event.
Would that support an animated gif, with transparency?
Do you have a better suggestion? -
Got stuck :-|
I seem not to be able to call a function in my class
class QTGUI_MainWindow : public QMainWindow
from the reimplementation of the notify event:class MyApplication : public QApplication { public: MyApplication(int &argc, char **argv ) : QApplication(argc, argv) { } virtual bool notify ( QObject *receiver, QEvent *event ) switch( event->type() ) { ....
There's something I just don't get with these classes in C++ - still used to years of ANSI C.
Can somebody give me a hint how I can solve this?
Tanks a lot. -
Do you mean your notify implementation doesn't get called ?
-
Nope, it's called and working perfectly.
I can perfectly manipulate the cursor with these lines from the notifier:QPixmap TouchEventCursorPixmap(":/Ring3"); QCursor TouchEventCursor(TouchEventCursorPixmap, -1, -1); QApplication::setOverrideCursor(QCursor(TouchEventCursor));
Because the problem I got stuck with is actually something different than the main topic of this thread I opened a new one for this here
What is remaining open in this thread is the following:
Is there a way to have at least a gray scaled or even colored cursor, maybe bigger than the current maximum of 64x64?
If not, I'll probably have to implement a workaround like showing a graphic for a short time at the location of the touch/click event.
Would that support an animated gif, with transparency?
Do you have a better suggestion? -
I don't think it is, however if you need that big a feedback, you should maybe avoid trying to do it on the cursor and have something more general like a spinner in a corner
-
Need to dig up this old thread ...
I (customer) would like to have graphic shown instead of the simple over-ridden cursor.
I am thinking of a png with transparency or even of an animated gif.What is the best approach to have a small graphic shown very quickly (load fast)?
Something like this maybe:
QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsPixmapItem item(QPixmap("c:\\test.png")); scene.addItem(&item); view.show();
I'd load the graphic at boot and later only show and hide at the relevant position.
Or is there a faster or better way? -
At a fixed position ?
-
Nope, varying with current touch position.
Couldn't get to display that graphic, and not frameless with the Scene. Tried with a QLabel instead .. again to no avail.Ended up in adding a Label in the Designer and set it transparent in Designer and load the png in Designer. From code, I am now only updating the position and show and hide.
This now works as expected for a static image. I wonder if this also works with an animated GIF ... will see.Thanks anyway
-
IIRC, you can use QMovie for gifs