Results 1 to 4 of 4

Thread: inherit signal and slot

  1. #1
    Join Date
    Jan 2011
    Posts
    212
    Thanks
    24
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default inherit signal and slot

    Hello forum,

    If a class specialize a base call and want to access the base classes signal through connection(...), is that valid in Qt?

    I have not found this is the documentation . OR did i miss it?

    I have found something as follows:


    connect(this, SIGNAL(base class's signal), other object, SLOT());




    Regards
    Sajjad

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: inherit signal and slot

    If a class specialize a base call and want to access the base classes signal through connection(...), is that valid in Qt?
    A sub class will inherit the base class signals/slots if they are not private, thus they for all purposes treated as its own signals/slots, just like other members.
    C++ rules apply normally.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: inherit signal and slot

    SLOTs can be virtual too, its pretty cool

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: inherit signal and slot

    This is one of the things which I like the about Qt C++ (may be C++ actually), either it be signals and slots both of them are normal functions at heart, and allow to be used as virtual functions, overloaded functions, overriding functions, const functions, and all-in-all they are type-safe.

    I rather read signal / slots as function to function connection.

Similar Threads

  1. Replies: 2
    Last Post: 3rd May 2011, 20:22
  2. Signal connected to slot (or signal)
    By Althor in forum Newbie
    Replies: 2
    Last Post: 6th July 2010, 10:00
  3. Replies: 1
    Last Post: 8th November 2007, 17:11
  4. signal/slot
    By popai in forum Qt Programming
    Replies: 16
    Last Post: 1st August 2007, 13:56
  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.