dreak
24th June 2015, 18:59
mouseEvent
Hi, I need to program pool.
Right now, I'd like to make a mouseEvent so that, when i click on the screen, i get the position of the mouse.
I know to use event->x(); to get the xCoordinate, but I don't know how to impletement the clickEvent itself.
I got:
void mouseMoveEvent(QMouseEvent* event)
{
if(event->button())
{
xPos = event->x();
yPos = event->y();
}
}
main
{
...
while(certain condition)
{
QMouseEvent *event;
while(!(event->button()))
{
event;
}
mouseMoveEvent(event);
...
}
If I do this, it gives a segmentation fault.
I got 0 experience with implementing a mouseclick, unfortunatly :/
Hi, I need to program pool.
Right now, I'd like to make a mouseEvent so that, when i click on the screen, i get the position of the mouse.
I know to use event->x(); to get the xCoordinate, but I don't know how to impletement the clickEvent itself.
I got:
void mouseMoveEvent(QMouseEvent* event)
{
if(event->button())
{
xPos = event->x();
yPos = event->y();
}
}
main
{
...
while(certain condition)
{
QMouseEvent *event;
while(!(event->button()))
{
event;
}
mouseMoveEvent(event);
...
}
If I do this, it gives a segmentation fault.
I got 0 experience with implementing a mouseclick, unfortunatly :/