I am using QT Creator to create what I thought was a quick GUI application. I've narrowed down the problem to this:
QLineEdit lineGwIpAddr should contain an IP address entered by the user (i.e. "127.0.0.1"). Right now when I click QPushButton btnTest I want to validate the IP address QString as such:
Qt Code:
void MainWindow::on_btnTest_clicked() { if (gatewayAddress.setAddress(ui->lineGwIpAddr->text())) { QMessageBox msgBox; msgBox.setText("IP Address is OK"); msgBox.exec(); } else { QMessageBox msgBox; msgBox.setText("Bad IP Address"); msgBox.exec(); } }To copy to clipboard, switch view to plain text mode
setAddress(const QString & address) should return true if the string was able to be parsed. But when I build I get the following error:
It looks like it is not recognizing QHostAddress as a class. I have included networking in my project by adding QT += network in the project file, so I'm not sure why I am still getting this error..../imagedownload/mainwindow.cpp:22: error: request for member `setAddress' in `gatewayAddress', which is of non-class type `QHostAddress ()()'
I've attached the entire project to this post. Any help would be greatly appreciated.
Bookmarks