Results 1 to 7 of 7

Thread: assign problem with array of QTcpSocket

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: assign problem with array of QTcpSocket

    You are not assigning a QTcpSocket* to a QTcpSocket*.

    Create a list or vector of QTcpSocket* like Wysota said.
    Example QList<QTcpSocket *> mySocketList;

    Add new sockets to that list and use the QList functions to access them.

  2. #2
    Join Date
    Feb 2010
    Posts
    28
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: assign problem with array of QTcpSocket

    ok, thank you very much, I will try it with a list...

  3. #3
    Join Date
    Feb 2010
    Posts
    28
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: assign problem with array of QTcpSocket

    Hi!

    I tried this with the sender() function but I had some trouble.

    in the slot function I have:

    myclass *tcpServerSender = qobject_cast<myclass*>(QObject::sender());

    but this pointer is always NULL, do you have any ideas, how can I get the pointer to the object?

    thanks!

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: assign problem with array of QTcpSocket

    You shouldn't really be using sender() and that ugly type casting. Use QSignalMapper instead.

Similar Threads

  1. declare an array of QSemaphore and array of slot functions
    By radeberger in forum Qt Programming
    Replies: 11
    Last Post: 2nd May 2010, 13:24
  2. Assign a wchar_t array to QString
    By jacky in forum Qt Programming
    Replies: 5
    Last Post: 18th April 2009, 12:28
  3. array of pointers to QtcpSocket
    By gQt in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th June 2008, 09:15
  4. boost::assign
    By Sivert in forum General Programming
    Replies: 0
    Last Post: 2nd May 2007, 00:23
  5. I can't assign TableView signals...
    By tomek in forum Newbie
    Replies: 5
    Last Post: 9th January 2006, 21:04

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.