How can I pass data between forms?
-
My application is working with a dynamic array, there is a button through which a modal window (Dialog) opens, in which the number of elements in the array is set. How can I pass the value to MainWindow after pressing the "Apply" button, the variable itself is initialized in mainwindow.cpp
-
My application is working with a dynamic array, there is a button through which a modal window (Dialog) opens, in which the number of elements in the array is set. How can I pass the value to MainWindow after pressing the "Apply" button, the variable itself is initialized in mainwindow.cpp
@Rezistence
Add a getter method to your dialog.If you need to get a single value, you can use this convenience class:
QInputDialog -
@Rezistence
Add a getter method to your dialog.If you need to get a single value, you can use this convenience class:
QInputDialog@mpergand I saw something about signals and slots, that they can be called and passed through them. Can you explain their work?
-
@mpergand I saw something about signals and slots, that they can be called and passed through them. Can you explain their work?
@Rezistence
Describe more precisely what you want to do with it; -
@Rezistence
Describe more precisely what you want to do with it;@mpergand I saw somewhere that you can send a signal to another form using their bundle and get data from it. This would be a good solution for my problem.
-
Signals and slots is not necessarily the best way to do what you want.
If it's simply ask your user for a value to change your array size, as suggested by @mpergand, using QInputDialog is a simple and effective way to do that.