I have a QLineEdit:
lePort->setText("3000");
QLineEdit *lePort = new QLineEdit();
lePort->setText("3000");
To copy to clipboard, switch view to plain text mode
In my tcpSocket I need to connect:
tcpSocket
->connectToHost
(QHostAddress("127.0.0.1"), quint16
(2000));
QTcpSocket *tcpSocket = new QTcpSocket();
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
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.
Bookmarks