I'm currently learning Qt/C++, and trying to write an app which consists of the following widget structure:
A (main window)
- B (left panel)
--- C (multiple widgets based on QLabel - allows user to mock up an optical circuit)
- D (right panel)
--- E (line edit boxes on form, containing details of currently selected 'C')
When the user clicks on a particular instance of widget C, I'd like to update the various form elements in E with the details stored within the selected widget (e.g. ID code). What's the best way to connect the two GUI regions together to achieve this?
So far I've tried the following:
[1] - Signals/Slots: I've put the following into B:
connect(instanceOfC, SIGNAL(clicked(int ID)), parentWidget(), SLOT(updateID(int ID)));
connect(instanceOfC, SIGNAL(clicked(int ID)), parentWidget(), SLOT(updateID(int ID)));
To copy to clipboard, switch view to plain text mode
Widget A contains the updateID() method, which contains the following code:
instanceOfD->instanceofE->setText(...);
instanceOfD->instanceofE->setText(...);
To copy to clipboard, switch view to plain text mode
When this line is executed, the application produces a segmentation fault.
[2] - I've put an eventFilter in A to catch MouseButtonPress events in C. I then get the same segmentation fault described above when I try to update the fields in E, and I also don't know how to transfer parameters stored in C this way.
I hope this makes some sense. Any suggestions would be greatly appreciated!
Bookmarks