How can I pass data from one form to another in Qt?
I have created a QWidgetProgect -> QtGuiApplication, I have two forms currently. Now I want to pass data from one form to another.
How can I achieve that ?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here are some options that you might want to try:
textChangedortextEditedsignal)Example with Signals and Slots:
Let’s assume that you have two windows:
FirstFormandSecondForm.FirstFormhas aQLineEditon its UI, namedmyTextEditandSecondFormhas aQListWidgeton its UI, namedmyListWidget.I’m also assuming that you create both of the windows in the
main()function of your application.firstform.h:
firstform.cpp
secondform.h
secondform.cpp
main.cpp