Hi,
You have to create a class that inherits from QGraphicsItem(in your case QGraphicsPixmapItem). Then redefine the "mouseMoveEvent" method on this class.
...
...
void mouseMoveEvent()
{
// your code here
}
class MyPixmapItem : public QGraphicsPixmapItem
...
...
void mouseMoveEvent()
{
// your code here
}
To copy to clipboard, switch view to plain text mode
Also you will need to connect some kind of SIGNALs and SLOTs from MyPixmapItem to the main window if you want to show the gray value into a QLabel or QSpinBox(just an example).
When you add the Item in the scene you have to create an object of this class instead of the base class
This:
scene->addPixmap(pix);
scene->addPixmap(pix);
To copy to clipboard, switch view to plain text mode
Have to be something like this:
MyPixmapItem *item = new MyPixmapItem();
myScene->addItem(item);
MyPixmapItem *item = new MyPixmapItem();
myScene->addItem(item);
To copy to clipboard, switch view to plain text mode
Bookmarks