Results 1 to 2 of 2

Thread: Realization of signal and slot

  1. #1
    Join Date
    Jul 2016
    Posts
    41
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Realization of signal and slot

    Qt Code:
    1. bh = new BluetoothHandler();
    2. connect(this, &PlayerControl::connectToDevice, bh, &BluetoothHandler::connectToSocket);
    To copy to clipboard, switch view to plain text mode 

    void connectToDevice(QBluetoothAddress address);
    void BluetoothHandler::connectToSocket(QBluetoothAddres s address);

    address is nowhere initialized. I wonder, which address would be after this connect?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Realization of signal and slot

    Quote Originally Posted by Blitzor DDD View Post
    [CODE]
    address is nowhere initialized. I wonder, which address would be after this connect?
    Well, the place in "this" that emits the signal will have to take care of passing a valid object to the signal when emitting it.

    Since QBluetoothAddress is a class, just creating an instance of it will create an initialiized object, so the emit cannot be called without a valid and initialized "address"

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 14th August 2014, 17:08
  2. Replies: 6
    Last Post: 4th March 2014, 15:09
  3. Replies: 8
    Last Post: 7th November 2012, 14:10
  4. Replies: 0
    Last Post: 6th November 2011, 07:49
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.