I am trying to mark points on top of a image,
- I select the topleft and bottomright points on the image
- generate grid points on top of the image (something like this )
http://img169.imageshack.us/img169/9...otfigure11.jpg
- the grid should be cleared later
currently i created a ImageItem class derived from QpixmapItem
#ifndef IMAGEITEM_H
#define IMAGEITEM_H
#include <QGraphicsPixmapItem>
#include <QtDebug>
#include <QGraphicsSceneMouseEvent>
#include <QPoint>
#include <QPainter>
#include <QObject>
{
Q_OBJECT
public:
ImageItem();
public slots:
signals:
};
#endif // IMAGEITEM_H
#ifndef IMAGEITEM_H
#define IMAGEITEM_H
#include <QGraphicsPixmapItem>
#include <QtDebug>
#include <QGraphicsSceneMouseEvent>
#include <QPoint>
#include <QPainter>
#include <QObject>
class ImageItem : public QObject ,public QGraphicsPixmapItem
{
Q_OBJECT
public:
ImageItem();
ImageItem(QGraphicsItem *, QGraphicsScene*);
public slots:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
signals:
void mouseClicked(QPointF);
};
#endif // IMAGEITEM_H
To copy to clipboard, switch view to plain text mode
#include "imageitem.h"
ImageItem::ImageItem()
{
}
}
emit mouseClicked(event->pos());
}
#include "imageitem.h"
ImageItem::ImageItem()
{
}
ImageItem::ImageItem(QGraphicsItem *parent, QGraphicsScene* scene) : QGraphicsPixmapItem(parent,scene){
}
void ImageItem::mousePressEvent(QGraphicsSceneMouseEvent *event){
emit mouseClicked(event->pos());
}
To copy to clipboard, switch view to plain text mode
i can get the topleft and bottomright points from the mousePressEvent
Now my problem is how can i draw points (which can be removed later) on top of QPixmapItem??
any ideas how to implement this? or if u have a sample code please share
Bookmarks