I have a QLineEdit:
Qt Code:
  1. QLineEdit *lePort = new QLineEdit();
  2. lePort->setText("3000");
To copy to clipboard, switch view to plain text mode 

In my tcpSocket I need to connect:
Qt Code:
  1. QTcpSocket *tcpSocket = new QTcpSocket();
  2. tcpSocket->connectToHost(QHostAddress("127.0.0.1"), quint16(2000));
To copy to clipboard, switch view to plain text mode 

In stead of having the quint16(2000) I would like to have the value of lePort. I tried
Qt Code:
  1. tcpSocket->connectToHost(QHostAddress("127.0.0.1"), QString::number(lePort->text()));
To copy to clipboard, switch view to plain text mode 
but it doesn't work.