simply i explain: first want to mouse press in graphicsscene and release the mouse. that point should be start point. then another plase i should press the mouse and release that will be end point then the line should be drawn. I can draw a line when mouse pressing and moving. but i want to know that abpve mentioned way. please some one help me. i am stuck in this .
I want to know about how to draw a line between two nodes. .
1.4k Views Asked by Frank Anushka Sachith AbagNale At
1
There are 1 best solutions below
Related Questions in QT
- C++ template using pointer and non pointer arguments in a QVector
- Using QPointer and QObject::connect with C++11
- qt How to style a QToolBar > QToolButton overflow button?
- Qt - Repeatedly write at beginning of file
- C++ Mongodb driver, not working
- deletion and cleanup of worker thread in Qt crashes
- How to drap item from QTableView to QPushButton?
- get image type from qimage
- C++ QT Getting part from QString
- How to connect a destroyed signal of C++ object from QML?
- How to get shader version from QOpenGLShader?
- Size of Qt QRadioButton able to get smaller, but not larger than default
- error WinSock.h has already been included Boost Windows Qt
- How to call a non-class member function with pointers as parameters with QtConcurrent::run?
- What is the difference between MinGW SEH and MinGW SJLJ?
Related Questions in MOUSEMOVE
- weird mouse coordinates on site
- MouseMove event is called even when cursor is outside of canvas. `Border`around canvas did not work
- how to implement mousemove after mousedown using js
- Event "While Button is Pressed"
- how to implement mousemove while mouseDown pressed js
- mousemove based scrolling script need to adapt for touchscreen use
- Vb.Net Move Mouse inside PictureBox
- Jerky horizontal scroll on hover
- How to move rectangles using mouse in c#
- Safari 8.0 (Yosemite) returns nothing on mousemove
- Instant of custom control is disappear when click outside it
- Dragging an element with mousemove handler stops tracking if mouse moves too quickly
- mousemove offset X/Y wrong in Chrome when used on a SVG text element
- How to rotate element to left and right based on mouse movement using jQuery & CSS
- MouseMove Event in Form
Related Questions in QGRAPHICSSCENE
- QGraphicsScene on a QMainWindow
- Qgraphicsview items not being placed where they should be
- Deleting an item from a scene
- Selecting several items and then taking distance between them
- what is the best way to convert a Qt object(QgraphicsItem) into C++ class object
- mousePressEvent not working as expected in QGraphicsScene
- Qt GraphicsScene on Widget
- QGraphicsScene::removeItem: item scene is different from this scene
- Zooming in a QGraphicsScene makes my drawings disappear sometimes
- Smoothly Updating QGraphicsscene
- Error while making arc
- how to find an item in the scene
- Arc in QGraphicsScene
- Error: Cannot allocate an object
- Snapping in grid using qt
Related Questions in MOUSEPRESS
- Autoclicker in Java for Skyrim
- e.getY() return value higher than expected
- Java - Create a button from a shape
- Trying to use multiple instances of Mouse pressed
- Qt: How to Find the Position of the Mouseclick Relative to an Image
- Robot class - If a Button Is Pressed?
- combobox steal keyboard from main window in pyqt
- Smooth line in QGraphicsScene with Qt
- Processing mousePressed()
- Installing an event filter and implenmenting mouseMoveEvent does not enable tracking cursor position
- How do i make images change color when clicked/ hovered in p5?
- Robot not pressing mouse during mouse movement method
- Program is not detecting mouse clicks
- Using mousePressed on the same object twice?
- QIcon inside combobox
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can capture the location of mouse when mouse is pressed on graphics scene by handling mousePressEvent() of graphics scene, and using QGraphicsSceneMouseEvent's pos() method and store it.
Letter whey you detect second mouse click, use first point and second point to draw line.
From you question it looks you already know how to draw line so i will not put anything on that regards.
Something like following,