Results 1 to 5 of 5

Thread: qt Signal and slots for plainly C++ class objects

  1. #1
    Join Date
    Jul 2018
    Posts
    26
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default qt Signal and slots for plainly C++ class objects

    We have a kind of:

    connect(socket, SIGNAL(readyRead()), this, SLOT(readyReadImp()))

    where let say slot ReadyReadImp() is implemented by using qtcpsocket class. Let say that I want to implement Same code in plainly C++ object. Let say that I have an old code in C++ only, so I wish to incorporate old code. Can I do it? How? And still to use benefits of signal and slots...

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

    Default Re: qt Signal and slots for plainly C++ class objects

    Of course you can still incorporate non Qt C++ in A Qt project.
    The only limitation is that the non Qt code on its self will not play with (Qt( signal and slots (you could use boost signals and slots and mix them with Qt's however).
    You can still use it in Qt slots however.
    That is, you can have a Qt wrapper to your plain C++ code, the wrapper will provide the signals/slots and call within it the plain C++ code.
    ==========================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
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt Signal and slots for plainly C++ class objects

    You can connect Qt signals to lambdas or static methods that can invoke your non-Qt C++ code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Aug 2018
    Posts
    2
    Qt products
    Qt4 Qt5

    Default Re: qt Signal and slots for plainly C++ class objects

    Hi to all!
    Tell me please, what slot of the form shoud I use to make something, when this form tsarts?
    Thanks for all.

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

    Default Re: qt Signal and slots for plainly C++ class objects

    Quote Originally Posted by Mirtexx View Post
    Hi to all!
    Tell me please, what slot of the form shoud I use to make something, when this form tsarts?
    Thanks for all.
    Please don't try to hijack the thread. Start a new one instead.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. signal/slots and dynamic objects
    By stingray in forum Newbie
    Replies: 4
    Last Post: 24th January 2017, 10:11
  2. signal/slots and dynamic objects
    By stingray in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2017, 17:46
  3. “Pass” slots from class to class
    By bmn in forum Qt Programming
    Replies: 1
    Last Post: 3rd October 2015, 01:17
  4. [Signals & Slots] Custom class' signal not detected
    By Mr_Cloud in forum Qt Programming
    Replies: 5
    Last Post: 26th July 2012, 11:35
  5. Replies: 1
    Last Post: 10th August 2011, 17:46

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.