I have an app that has a main window and four sub windows. Let's call the sub windows/modules, A, B, C and D. There are three QPushbuttons each in windows A, B and C (9 total). Each of these nine buttons, when clicked, call the same report function in window D. Depending on which WINDOW sent the click, I want to change some column headings in the report function in window D. I don't really care which of the nine BUTTONS was clicked. It's like I need an "If statement" in the function in window D to determine which Window sent the click. If determining which Window sent the click is not possible, I can still do what I need if I know which BUTTON was clicked.

I've read about Sender() but do not know if this is what I need nor do I know how to code it. Nor do I know C so its hard to follow examples.

Sample code for 3 buttons in one of the windows:
Qt Code:
  1. self.ui.WtgAvgPrintBtn.clicked.connect(self.viewstocks)
  2. self.ui.WtgAvgPrintBtn_2.clicked.connect(self.viewstocks)
  3. self.ui.WtgAvgPrintBtn_3.clicked.connect(self.viewstocks)
To copy to clipboard, switch view to plain text mode 

The viewstocks function calls a report function in another window (window D in my example, but it's really called reportsWindow)
Qt Code:
  1. def viewstocks(self):
  2. self.reportsWindow.byassetclass()
  3. self.reportsWindow.show()
To copy to clipboard, switch view to plain text mode 

My questions:
1. What code do I use in widows A, B and C to designate which Window or button was clicked
2. What code in window D do I use to determine which Window or button was clicked,. ie. the "If" statement
3. If I have to go the route of determining which BUTTON was clicked, does it matter if the three button object names in window A are the same as the object names in B and C?
thanks