tell me what do you want to write to socket with that line?Qt Code:
socket->write(chat->setHtml(html));To copy to clipboard, switch view to plain text mode
and second question:
what are you already writing to socket with that line?
tell me what do you want to write to socket with that line?Qt Code:
socket->write(chat->setHtml(html));To copy to clipboard, switch view to plain text mode
and second question:
what are you already writing to socket with that line?
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
Hi, i only want to send a .png with a socket and them display that same .png on a QTextEdit.
Thanks for your time!
ok but can you tell me what exactly is that line doing? I know this but I want you to just think for a while and analize that line carefully. What is most important - what exactly you pass to socket to write?
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
Believe me, i have thought about that line several days hehe... I think im passing a html quote to the socket and them displaying that html quote on the QTextEdit (chat)... Obviously, its wrong, otherwise i wouldnt be asking here hehe...
if you don't understand why
won't work, you need to ask yourself how a void (the result of setHtml) can be written a socket...Qt Code:
socket->write(chat->setHtml(html));To copy to clipboard, switch view to plain text mode
The following should compile:
If that is what you want is another matter.Qt Code:
socket->write(chat->setHtml(html)->html());To copy to clipboard, switch view to plain text mode
It is not clear to me (or us, it seems) what you really want to do.
Nop, it didnt work, now this is the error message:
error: void value is not discarded as it should be
error: base operand of '->' is not a pointer
No, you are passing html string to QTextEdit and result of that method (which is "void" - what you can read in documentation) you are passing to socket. So you are passing void - which is exactly nothing - to the socket. So you are writing nothing. And it is only simple C++ knowledge needed to discover that :P
change it into those lines:
Qt Code:
chat->setHtml(html); socket->write(html);To copy to clipboard, switch view to plain text mode
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
@faldzip:
That didnt work neither, error:
error: found no matching function for call ‘QTcpSocket::write(QString&)’
@wysota:
So, what do you recomend to do this? Or better, how can i put that image in the QTextEdit using the socket?
Last edited by wysota; 2nd October 2009 at 23:03.
Oh my God....
Let's see... you are loading an image and placing its url into an html document, then setting that html on a text edit with a method returning void and wanting the result of this method to be written to a socket (look in the dictionary what the word "void" means in English) and expecting the contents to be transfered to the other end of the socket... Please tell me I'm wrong...![]()
Last edited by wysota; 2nd October 2009 at 19:07.
Definitely not a method returning void. And, frankly, surely a good book about C++ and programming in general. Then also a bit of RTFM and STFW.
A good first step would be to browse the reference manual.Or better, how can i put that image in the QTextEdit using the socket?
Oh come on man! Im a beginner and you are a Guru, you can help me out with this!
Then act as a beginner and learn the basics first before moving forward to more advanced subjects. If you don't even know what a return type of a method does how do you expect to make progress with using the API?
I still don't know what you want to do so it is quite hard to help you. If you want to transfer this html through the socket then use QTcpSocket::write() as already told. Finding the proper transformation from the type returned by QTextEdit::html() to the type accepted by QTcpSocket::write() is your homework. It should take you no more than 20 seconds to find the appropriate method provided you start looking for it.
Bookmarks