PDA

View Full Version : Creating a Chat



Demyon
25th September 2015, 05:23
Hello Qtiers !

As I am new here, I might be posting at the wrong section, if that is the case I do apologise.

Anyway,I just started working with QT Designer a few weeks ago, this started with me wanting to learn python. Since I found it quite interesting and QT has alot of a positive feedback, so I am trying to go with it, even tho I am having sort of an hard time.
At the moment I am trying to create a basic chat (like mirc), that will eventually be incorporated on an app that will be projected with some other features.
My first problem so far is that I am finding it hard to make a QlineEdit (where the user is suppose to type), to connect (with signals/slots) to the QTextBrowser (where the text is gonna show up) in order to print out for the user to see and read. Keep in mind I am talking about QT designer at the moment, just creating the UI so far, but I would like to know this for future reference in my project.

PS: If I am not being transparent enough, do point it out, its kinda late here atm.

Sincerely, Demyon

anda_skoa
25th September 2015, 12:05
This has nothing to do with designer at this point.

In your Python code you connect to one of QLineEdit's returnPressed() signal and in the slot you get its text and append it to the text edit (and also send it to the server).

Cheers,
_

Demyon
25th September 2015, 13:01
But is it not possible to be done with designer tho, that was my question

PS: the connecting part i mean

anda_skoa
25th September 2015, 13:30
In designer you can only connect directy between widgets.
Since you need the text from the line edit you'll need some code to retrieve the text as returnPressed() has no arguments.

Cheers,
_