I'm trying to send variables from a dialog back to the Main Window. However, so far I have only been able to pass the default values. My code looks like this:
class OptionsDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.ui = Ui_Advanced_Options()
self.ui.setupUi(self)
self.ui.buttonbox_options.accepted.connect(self.Get_Data)
def Get_Data(self):
self.value = self.ui.sellingSpin.value()
return self.value
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, *args, obj=None, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
"""data about MainWindow"""
def get_input_data(self):
Options = OptionsDialog(self)
self.value = Options.Get_Data()
print(self.value) # this is just an example to see what variable I got
In the dialog I count with many spinboxes. Since the default value is 1, I always get 1. No matter if I had changed it before or not.