Results 1 to 3 of 3

Thread: connection Problem

  1. #1
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default connection Problem

    Hi guys,

    I have 2 classes: graph and gscene(which inherits QGraphicsScene). THe graph class includes a gscene object. I would like to connect the gscene signal to the parent graph class, but after connecting the slot is not invoked.

    Here's the code: (signal in the gscene)

    signals:
    void vSignalZoomRectangle(QRectF _rectangle);

    and here is the connection in the gscene constructor:

    connect(this,SIGNAL(vSignalZoomRectangle(QRectF)), this>parent(),SLOT(vZoomSceneRectangle(QRectF)));


    the code compiles, but does not work.

    Any idea?
    THank you beforehand.

    Maverick
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

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

    Default Re: connection Problem

    You will have to do an explicit cast to ggraph(if I understand correctly ).

    So you have ggraph which contains a scene.
    What is the base class for ggraph and what parent do you pass when you create it?

    If in your code parent() means QObject:arent(), then a cast is needed.

    Check the debug output. A warning message should be there: connect: no such slot....

    Regards

  3. #3
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: connection Problem

    Thank you, you're right.
    Unfortunately, my problem was so 'novice'. I've declared the slot as a simple method not as a slot. No comment needed.

    Thank you for your reply.

    Maverick
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

Similar Threads

  1. Mysterious Qt4.2.0 Mysql 5.0.41 connection problem
    By locus in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2007, 17:59
  2. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 09:52
  3. Signal-slots connection problem.
    By impeteperry in forum Qt Tools
    Replies: 26
    Last Post: 23rd January 2007, 14:33
  4. connection problem
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 7th July 2006, 22:14
  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.