PDA

View Full Version : QTextEdit chat app



Syppal
27th January 2016, 20:31
Hello fellow Qt programmers. After a lot of research I have concluded that I'd like to create a chat application using QTextEdit.

What's needed:
* Being able to send "messages" and format it like the following: http://i.imgur.com/VEdVagR.png (This one was done using QTreeView, only problem was that you can't select and copy more than 1 message).
* Being able to insert clickable objects, such as images etc.
* Paint the background text and adjust its alignment based on receive/sent message
* Being able to copy text without copying the picture Frame that's on the left.

Is there anyone out there that is willing to point me in the right direction of how I can achieve this result?

I have read everything found here: http://doc.qt.io/qt-4.8/richtext.html
Tips such as what to read and possible examples would be greatly appreciated!

anda_skoa
28th January 2016, 10:17
This looks and sounds like it would be easier with QtQuick instead of QtWidgets.

Cheers,
_

Syppal
28th January 2016, 14:09
This looks and sounds like it would be easier with QtQuick instead of QtWidgets.

Cheers,
_
Thanks a lot for answering. Yes, it may be easier using QtQuick, but I'll use that as the last resort.
I'm thinking that I could create a custom QTextFrame and put an image on the left side (and make it nonselectable with copying etc) and the text on the right, but I'm not
quite sure of how to do this. Like stated above, any tips would be highly valued!

anda_skoa
28th January 2016, 15:10
Ok, doing it the hard and complicated way is of course your choice :)

Cheers,
_

Syppal
28th January 2016, 16:08
Ok, doing it the hard and complicated way is of course your choice :)

Cheers,
_
I haven't used QTQuick yet, and I'm a bit afraid of the unknown :). Would you recommend that I create my widget using Qt quick and that I integrate that window in
my QWidget application? Or do you recommend that I scratch the project and use QtQuick instead?

Cheers!

anda_skoa
28th January 2016, 17:18
Well, if you already have a widget based application and you only need this last view, then perhaps using QGraphicView would be on option.

For a new application and these requirements I would be going for QtQuick.

Cheers,
_

Syppal
28th January 2016, 23:56
Well, if you already have a widget based application and you only need this last view, then perhaps using QGraphicView would be on option.

For a new application and these requirements I would be going for QtQuick.

Cheers,
_

Okey, thank you.