Results 1 to 5 of 5

Thread: Guidance needed to create a graph for which I should be able to rearrange the nodes.

  1. #1
    Join Date
    Mar 2017
    Posts
    3
    Qt products
    PyQt3 PyQt4
    Platforms
    Windows

    Default Guidance needed to create a graph for which I should be able to rearrange the nodes.

    I need to create something like this

    https://www.youtube.com/watch?v=OHdc-wtSmg0

    I would like to be able to represent graphs like the one in the clip indicated above and to be able to re arrange the nodes using the mouse. That zoom that you see in the clip is not a must

    This would be my first attempt to work with Graphics in Qt. Can anybody point me to some tutorials or examples relevant to my task?

    Note: I am a PyQt user

    thank you
    MM
    Last edited by MiniMe4Qt; 25th March 2017 at 15:13.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Guidance needed to create a graph for which I should be able to rearrange the nod

    You should start by looking at the "elastic nodes" example in the Qt distribution. It's in C++, but you could use that as a starting point. If you Google for that you'll see that there is a YouTube video of a PyQt version (without source code, of course). There are many other examples as part of the Qt Graphics-View framework.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Mar 2017
    Posts
    3
    Qt products
    PyQt3 PyQt4
    Platforms
    Windows

    Default Re: Guidance needed to create a graph for which I should be able to rearrange the nod

    Thanks a lot! That really helped
    If anyone else is interested here are two examples

    https://gist.github.com/reusee/2406975
    http://ftp.ics.uci.edu/pub/centos0/i...lasticnodes.py <--lacks the edges but if you move the nodes they stick to that position. The first example has edges but when you move a node it moves the other connected nodes too

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Guidance needed to create a graph for which I should be able to rearrange the nod

    Yes, the Qt Elastic Nodes example is supposed to demonstrate the graphics / view framework and the animation framework, so it uses animation and simulated springs to move connected nodes and then return them to an equilibrium position after the arrangement is disturbed by moving one of them.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Mar 2017
    Posts
    3
    Qt products
    PyQt3 PyQt4
    Platforms
    Windows

    Default Re: Guidance needed to create a graph for which I should be able to rearrange the nod

    Quote Originally Posted by d_stranz View Post
    Yes, the Qt Elastic Nodes example is supposed to demonstrate the graphics / view framework and the animation framework, so it uses animation and simulated springs to move connected nodes and then return them to an equilibrium position after the arrangement is disturbed by moving one of them.
    I will have to find a way to change that functionality
    I do not need the elastic thing, I just need the links to stick to nodes but I must be able to move nodes

Similar Threads

  1. Graph (nodes, edges) Drawing in Qt
    By Sabbir in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2018, 07:50
  2. How to create own graph(Curve graph) using Qt ?
    By karankumar1609 in forum Qt Programming
    Replies: 3
    Last Post: 11th July 2013, 11:48
  3. generate a graph of n nodes
    By saman_artorious in forum Qt Programming
    Replies: 0
    Last Post: 6th July 2013, 08:25
  4. How to create a media graph?
    By Potter in forum Qt Programming
    Replies: 2
    Last Post: 16th July 2010, 15:00
  5. Files needed to create a package
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 30th April 2007, 13:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.