Results 1 to 2 of 2

Thread: Advice on best way to link drawing and tree

  1. #1
    Join Date
    Dec 2010
    Posts
    55
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Advice on best way to link drawing and tree

    I have a data table which includes coordinate values which correspond with associated properties.
    I plan to have a QGraphicsScene where circles are drawn based on each coordinate value.
    Then, I also wish to have a QTreeView/Widget next to it with a branch for each coordinate/circle.

    When the user clicks on a specific circle, I would like the QTree to select the corresponding entry.
    When the user clicks on the specific QTree item, I'd like the corresponding circle to be highlighted

    I can think of two ways to do this:
    1. as I read the table, and start drawing circles and populate the tree, link each coordinate - circle pair using signal/slots for each
    2. create a data structure saving the pointer to the circles and tree items. Setup one signal/slot, passing an ID value, the lookup the pointers in the data structure.

    I'd appreciate any other ideas on the best way to do this.
    Thanks
    Running:
    RHEL 5.4
    Python 2.7.2
    Qt 4.7.4
    SIP 4.7.8
    PyQt 4.7

  2. #2
    Join Date
    Feb 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Advice on best way to link drawing and tree

    Hi,

    Look at the "Chart" example included in the Qt SQK. The behaviour is really close to what you are describing. However it does not use a QGraphicsView to render the charts. It is also using the Model-View-Controller design pattern, so you are probably required to understand it first if you are not familar with it.

Similar Threads

  1. Need advice or how to increase drawing perfomance
    By dkoryagin in forum Qt Programming
    Replies: 7
    Last Post: 18th November 2011, 00:22
  2. Replies: 11
    Last Post: 5th May 2011, 14:05
  3. How to link a Push Button with a Web link ???
    By prajnaranjan.das in forum Newbie
    Replies: 3
    Last Post: 10th December 2010, 07:25
  4. Replies: 4
    Last Post: 15th March 2010, 12:52
  5. Replies: 8
    Last Post: 8th October 2009, 16:59

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.