Qt Tutorials For Beginners – Creating Simple Login Form in QT




In this tutorial we will learn How to create a Simple Login Form in QT

File->New File or Project…

Applications->Qt Gui Application->Choose…

We keep the class as MainWindow as given by default.

Now We will create the second dialog by following step

Right Click Project -> New -> Qt -> Qt Designer Form class -> Choose -> Dialog without Button

Give the class name “SecDialog” and click finish.

qt Login App Project Structure
qt Login App Project Structure

LoginApp.pro

Now we will design our mainwindow.ui file

Qt Login fom design

Qt Login fom design

qt second form design
qt second form design

main.cpp

 

mainwindow.h

 

mainwindow.cpp

 

secdialog.h

 

secdialog.cpp

 

resource.qrc

 

Output

Qt Login fom login fail
Qt Login fom login fail
Qt Login fom output success
Qt Login fom output success
Qt Login second fom
Qt Login second fom
  • Hạnh

    I tried this code but when i build, Error occurs that “‘class Ui::MainWindow’ has no member named ‘lineEdit_username’QString username = ui->lineEdit_username->text()”
    What should i do 😕

  • Allan Schwartz

    can you provide the file:
    “:/resources/img/login-icon.png”

  • chalchal

    hello i want to make a loginApp and combine the webengineview how can i do that both ?