I wanted to drawing a mono color cursor when mouse start to drag.
But it seems that only support QPixmap format(ARGB color, not mono color).
Do we have method to draw mono color cursor when we start dragging ?
Printable View
I wanted to drawing a mono color cursor when mouse start to drag.
But it seems that only support QPixmap format(ARGB color, not mono color).
Do we have method to draw mono color cursor when we start dragging ?
Can we see the code? QBitmap inherits QPixmap so everything that's possible using QPixmap should be doable using QBitmap.
You can reproduce it by modify exmaple ~qt4.x.src/examples/draganddrop/draggableicons/dragwidget.cpp
Replace Line #110 ( drag->setPixmap(pixmap); ) with
The cusor will be color, not monoCode:
Qt Code: static unsigned char drag_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0xff, 0xc1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x0f, 0x40, 0x10, 0x00, 0x40, 0x10, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
Works quite fine for me. I just replaced the construction and serialisation of the pixmap from the example with your pixmap.
It did not work in my enviornment.
When I pressed some widget and try to move, you can find that cursor's background is wrong.
That is, the cursor must be mono, not color.
What exactly did you do? Did you replace all occurences of the color pixmap in code with the bitmap?
I only replaced Line #110 ( drag->setPixmap(pixmap); ) with my code
As I said, you have to replace the construction and serialisation code of the pixmap. Otherwise your pixmap won't be used at all (the code I mentioned is around line #100 or earlier).
I am sorry that I can not deliver my question clearly.
I attached drag.jpg file, and I wanted the cursor in the picture is mono-color.
I do not wanted to change all content of pixmap.
I only wanted to show mono-color mouse when dragging.
That is, I wanted to set mono-color in function "drag->setPixmap()".
Thanks your reply.:)