Results 1 to 6 of 6

Thread: Another signal and slot question

  1. #1
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Another signal and slot question

    Is there a way to connect a signal of a MDISubWindow to a slot in a main window? I have something like this:

    Qt Code:
    1. connect(fvui.closePBpvf, SIGNAL(clicked()), nnDBSMainWindow, SLOT(closeActiveSubWindow()));
    To copy to clipboard, switch view to plain text mode 

    But I keep getting the compilation error: src/nnDBSPieceViewForm.cpp:27: error: ‘nnDBSMainWindow’ was not declared in this scope

    I then tried adding #include "nnDBSMainWindow.h" to the form, but now I get the compilation error: src/nnDBSPieceViewForm.cpp:28: error: expected primary-expression before ‘,’ token

    Can someone help me out please? Thanks in advance!
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Another signal and slot question

    You need to have a pointer to the object you want to connect the signal from/to. This is basic C++ - all rules that apply in regular C++ apply here as well.

  3. #3
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Another signal and slot question

    As a noob, I'm not sure I understand what you mean. I thought I already had the pointers, fvui.closePBpvf's signal to nnDBSMainWindow's slot.
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Another signal and slot question

    Where is the pointer called nnDBSMainWindow declared? Or are you mixing it up to a class name?
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Another signal and slot question

    Obviously the compiler thinks you don't. I don't know your code, so I can't suggest a solution. The "nnDBSMainWindow" variable is not declared in the scope of the connect statement.

  6. #6
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Another signal and slot question

    ok, I guess I am mixing the class name with pointer. How would I create a pointer from a child signal to a parent slot?
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

Similar Threads

  1. Signal to specific object slot
    By bunjee in forum Qt Programming
    Replies: 2
    Last Post: 27th December 2007, 15:51
  2. templated signal or slot
    By QPlace in forum Qt Programming
    Replies: 1
    Last Post: 4th August 2007, 11:50
  3. signal not getting communicated to slot
    By quickNitin in forum Qt Programming
    Replies: 17
    Last Post: 2nd June 2006, 04:56
  4. Manually send signal to slot
    By donmorr in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2006, 15:03
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

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.