Results 1 to 2 of 2

Thread: QString and Threads

  1. #1
    Join Date
    Jan 2006
    Posts
    185
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default QString and Threads

    SOLUTION:

    message is the variable, but also the name of the class. So, change the name of the variable


    I have a class that allows me to do

    Qt Code:
    1. message->parseMessage("hello");
    To copy to clipboard, switch view to plain text mode 

    From another thread I call a function in the first thread, I also pass a QString to that function.

    Qt Code:
    1. void Client::readThreadMessage(QString message){
    2. message->parseMessage(message);
    3. }
    To copy to clipboard, switch view to plain text mode 

    For some reason I get this compiler error:

    client.cpp: In member function `void Client::readThreadMessage(QString)':
    client.cpp:127: error: base operand of `->' has non-pointer type `QString'
    make[1]: *** [release\client.o] Error 1

    What is wrong ? Why I cannot just use the QString that came from the other thread ?
    Last edited by probine; 3rd January 2007 at 22:38. Reason: Found the solution

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QString and Threads

    Quote Originally Posted by probine View Post
    What is wrong ?
    "message" is not a pointer, but QString --- the one you pass as an argument. Change its name and it should work.

Similar Threads

  1. Querying within Threads
    By bera82 in forum Qt Programming
    Replies: 11
    Last Post: 12th March 2008, 01:08
  2. signal/slots across threads in Qt4
    By Ambiorix in forum Qt Programming
    Replies: 7
    Last Post: 31st July 2006, 08:05
  3. Threads in GUI application
    By blackliteon in forum Qt Programming
    Replies: 7
    Last Post: 14th April 2006, 09:48
  4. [QT4] threads, signals, and slots, please help.
    By ucntcme in forum Qt Programming
    Replies: 12
    Last Post: 25th January 2006, 14:23
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15: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.