Results 1 to 7 of 7

Thread: Problems with signals and slots [probably c++ issue]

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2012
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with signals and slots [probably c++ issue]

    I apologise for being too vague.

    The function is the QGraphicsScene::mouseDoubleClickEvent().

    1) The first "it" is the object, I wanted to update the QTreeWidget whenever the object is being double-clicked.
    2) The second "it" refers to the same object which has not been instantiated.
    3) The third "it" refers to the connection that I wanted to connect between the myCable object and myScene object, however I only instantiate the myCable object in one of myScene methods.
    4) The fourth "it" refers to the myCable object which I have instantiate in one of the myScene methods.

    E.g. myScene.cpp
    void myScene::myCableToolsDrawSlot(int x, int y, int x2, int y2)
    {
    myCable cable = new myCable();
    ...
    ...
    }

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Problems with signals and slots [probably c++ issue]

    If "the object" (presumably intended to be a QGraphicsItem) has not been instantiated then it cannot be double-clicked. Your description is not doing you any favours.

    If you have implemented a double-click handler on the scene then you can determine the scene objects that are at the double-click position with QGraphicsScene::itemAt() or QGraphicsScene::items(). Your scene can emit any signal it likes to update a QTableWidget. There is no need for a connection between an item in the scene and the scene (graphics items are not QObjects and cannot emit signals anyway). There's no need for a connection between the graphics item and and external table widget.

    When your scene creates a new item the scene can tell the table widget about it if need be.

Similar Threads

  1. Problems with signals and slots
    By zzz9 in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2011, 08:52
  2. Signals and Slots
    By Maluko_Da_Tola in forum Newbie
    Replies: 3
    Last Post: 29th July 2010, 23:57
  3. Signals and Slots
    By 83.manish in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2008, 10:31
  4. regarding signals/slots
    By jjbabu in forum Qt Programming
    Replies: 2
    Last Post: 4th October 2007, 09:32
  5. Signals and Slots
    By merry in forum Qt Programming
    Replies: 4
    Last Post: 22nd February 2007, 08:11

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.