First, refer to: http://bbs.qter.org/forum.php?mod=viewthread&tid=12,
after a detailed look at the above tutorial, do not refer to the above tutorial, and follow the steps below to complete the login interface design, so that in the design process and procedures to form their own understanding, enhance the learning effect:
1, new QT GUI application 2, add a button in the main window or other design, if only for testing do not need to make changes to the main window directly into the 3rd Step 3, the project to add new files--designer class, And after the successful creation of the UI design interface dragged into two labels and two lineedit as the user name and password input, two buttons are renamed to login and Exit 4, the right exit button to go to the click () function corresponding to the slot function, set to close (), When you click Exit, you exit the program. 5. Go to the Click () slot function of the login button, use the IF function to determine if the user name and password are correct (lineedit text (), and then accept (), and log in successfully after clicking the login button. The error is to use Qmessagebox's warning function to pop up the warning window, the content is self-determined, the above is the most basic login window design test steps, there are several small details need to refine 6, password should not be displayed: In the UI design interface, Set the Echomode in the properties of the Password input box to password so that the black point is displayed when the password is entered, or in the constructor for the CPP file of the corresponding designer class, using Ui->pwdlineedit->setecho ( Qlineedit::p assword) function to set the password mode) 7, in the judgment function after password input error (else) automatically clears the user name password and repositions the cursor to the input box: Naturally, the use of Lineedit's clear () function and SetFocus () function; 8, remove the user name, the password in the tail and the space: Lineedit trimmed () function
Login window design Simple test steps