ok. will create my Ui form in mainwindow form. But declaration of GraphicsView to be done in sub class mouseevent.cpp and mouseevent.h, which is not having the Ui form. Im confused by seeing Scribblearea example. Here positions are collected from scribblearea.cpp and same is brought on mainwindow of class. Let me give a try. or i will post the code. based on comments i will try to do it. Thats wat i can do now
Dear All,
Finally I got mouse press/release event on Graphicscene by eventfilter. Im getting the co-ordinates by mouse events. For the same positions to draw lines I have made paint event,but calling paint event from switch (event filter) is not possible. Any methods to call the paint event.
Thanks in advance
Store the mouse coordinates and use them later in paintEvent.calling paint event from switch (event filter) is not possible
ya.. Im able to get mouse positions on QpointF .. but in event filter points are stored .. by releasing the mouse button it has to draw line.. in header file i have void PaintEvent (QPaintEvent *event ).
but it has to be called after release button is left...
In header.cpp i have void MainWindow::PaintEvent then following by painter pen then draw line.. the positions are from event filter...
Call "update()" after storing the coordinates and releasing the mouse button.by releasing the mouse button it has to draw line
Im not able to access the values of Mouse press/release events from Case events to and not able to carry the same values to void MainWindow:aintEvent(QPaintEvent *e).
To draw the line, I have called update() function at Mouse release case in event filter.Im getting all junk or Hexa values in qDeug...
And you want us to guess what is wrong?
Sorry. Im not able to point it out. In case QEvent::GraphicsSceneMouseRelease: Im getting the ScenePos, but when it is called in void MainWindow:aintEvent(QPaintEvent *e) same data/value is not coming. Or im getting the address of it or wat. Im feeling wrong somewhere, but finding it hard to correct it
Added after 51 minutes:
Yes I have stored in Case events in int x,y,x1,y1 for respective points. while calling same x,y,x1,y1 im not getting it when draw line or void MainWindow:aintEvent(QPaintEvent *e)
Last edited by Vivek1982; 12th August 2014 at 12:35.
This is pointless.
Unless you actually show the code where you store and retrieve the values, there is nothing anyone else can do.
Cheers,
_
Hi..
I have attached the code in a zip file. I have to store the co-ordinates but mouse points are not getting stored in this variable for paint on scene.
Last edited by Vivek1982; 22nd August 2014 at 13:15.
If you want to have access to the values from a different method, you should store them in the member variables, not in local variables.
Cheers,
_
ok.. plz can i get link supporting on member varaible or how it can be used in my condition to store data and process while painting
http://www.cplusplus.com/doc/tutorial/classes/can i get link supporting on member varaible
Vivek1982 (27th August 2014)
Bookmarks