Binji
12th November 2007, 23:31
First of all hello to everyone. Im still new to Qt but getting better:)
And now to my question.. i have a QLineEdit widget which must not be empty when user clicks a certain button. So i wrote this:
if (serverAddress.text().trim()!= "" && serverAddress.text().trim() != null) {
serverNameValid = true;
}else {
errorMessage += "\nServer name cannot be empty!";
}
Simple enough right? But the problem is.. it doesnt work! text() method never returns an empty string even if the QLineEdit widget is empty! Is there anything i missed?
Thanks for your reply
edit: I apologize if I shouldnt post Jambi stuff here but didnt see any other appropriate forum.
And now to my question.. i have a QLineEdit widget which must not be empty when user clicks a certain button. So i wrote this:
if (serverAddress.text().trim()!= "" && serverAddress.text().trim() != null) {
serverNameValid = true;
}else {
errorMessage += "\nServer name cannot be empty!";
}
Simple enough right? But the problem is.. it doesnt work! text() method never returns an empty string even if the QLineEdit widget is empty! Is there anything i missed?
Thanks for your reply
edit: I apologize if I shouldnt post Jambi stuff here but didnt see any other appropriate forum.