Results 1 to 14 of 14

Thread: Problem in attachig two polygons

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Problem in attachig two polygons

    Hello,

    I assume you are trying to make some kind of electronic circuits designer.
    I'm afraid that your approach is a little too simple.

    You should keep account of your ports.
    For example, let's say you have an AND port in the scene.
    Next, you add an OR port and you want to connect it to the output of the AND port.
    Initially the OR port will be placed somewhere in the scene. You drag it with the mouse and when you are near the output of the and the OR will snap to the AND port and automatically a connector will be created.

    By snap I mean that one input of the OR port will be aligned to the output of the AND gate.
    If you drag it further the connector disappears.

    All I am trying to say is that your app should be more interactive.

    Keeping account of the items is not hard. You always can access them via QGraphicsScene::items.

    When you drag a port you just look at the other items near it, to see if you can connect to one of the them ( maybe define a snap distance ).

    Regards

  2. The following user says thank you to marcel for this useful post:

    rohitjun (9th May 2007)

  3. #2
    Join Date
    Mar 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Problem in attachig two polygons

    Thanks alot for such a precious reply Marcel

    You are perfectly right that i am trying ot build a electronic desing application.

    yes i completely agree with you that my application should be more interactive.

    But the ports will not be attached automatically when they come near to each other.The user has to click one of the connector output of the "suppose" OR port and the drag the mouse till the inut connector of "suppose" And port. Then the connection between the two ports will be established.

    I thought of a approach, " When the user put a port on the scene then it will have one input and two output connector. But if the user wish to add or delete any connector he has to right click and then add or delete the connector through pop up menu. So in the begining i am trying to create a Port with connectors which user can put on the scene window. Connector polygon will handle the wiring between ports."

    Please give some suggestions on it.
    If you think , i am wrong way, please tell any other approach.

    Regards
    Rohit

  4. #3
    Join Date
    Mar 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Problem in attachig two polygons

    Dear Marcel

    Good morning

    I tried to make two polygons join together. But setPos,moveBy doesnt work for me as well as i tried to combine directly when i use setPolygon(First polygon+ second polygon) function but this create one polygon over another.
    Now i am thinking of not to use connector class. I think i can set some points on the Port(AND) itself which can be used to connect to other ports. It means any port will connect to new port with a new point for wiring whenever the user will wire to a new port.

    Please suggest,

    Rohit

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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
  •  
Qt is a trademark of The Qt Company.