Dear All,
Im getting mouseevent at when i click the mouse on the GraphicsScene. Im getting the position/co-ordinate also, where as release event im getting the co-ordinate/positions. please Suggest me
#ifndef APP_H
#define APP_H
#include <QMainWindow>
#include <QGraphicsScene>
#include <QPoint>
#include <QMouseEvent>
protected:
private:
int x,x1,y,y1;
#endif
#ifndef APP_H
#define APP_H
#include <QMainWindow>
#include <QGraphicsScene>
#include <QPoint>
#include <QMouseEvent>
protected:
void changeEvent(QEvent *e)
void mousePressEvent (QMouseEvent *e)
void mouseReleaseEvent (QMouseEvent *e)
private:
int x,x1,y,y1;
QPoint *point;
#endif
To copy to clipboard, switch view to plain text mode
#include "app.h"
#include "ui_app.h"
ui(new Ui::APP)
{
ui->setupUi (this);
}
{
x=point.x();
qDebug()<<x;
y=point.y();
qDebug()<<y
}
{
x1=point.x();
qDebug()<<x1;
y1=point.y();
qDebug()<<y1;
}
#include "app.h"
#include "ui_app.h"
APP::APP(QWidget *parent):
QMainWindow(parent),
ui(new Ui::APP)
{
ui->setupUi (this);
}
void APP::mousePressEvent(QMouseEvent *e)
{
QPoint point=e->pos();
x=point.x();
qDebug()<<x;
y=point.y();
qDebug()<<y
}
void APP::mouseReleaseEvent(QMouseEvent *e)
{
QPoint point=e->pos();
x1=point.x();
qDebug()<<x1;
y1=point.y();
qDebug()<<y1;
}
To copy to clipboard, switch view to plain text mode
Im getting x,y position data of Graphic scene when i click on scene, but not x1, y1 positions when i release mouse. By getting all co-ordinates i can draw line.
Bookmarks