Possible to move event slots?
-
I have a couple of QTableWidget instances in a QGroubBox and the tables have a data dependency. When an element is selected in one table data associated with the selected element is written to the second box.
When I added the slot, the slot entry and the method were added to mainwindow. First, main window at least two levels away from the group box, and it seems reasonable that the group box should be responsible for its operation.
Is it possible to move the slot from the mainwindow to the groupbox. If all of the slots are managed by mainwindow, the mainwindow will become a very large entity, and very confusing. I know form mainwindow I can send a message to the groupbox to get the work done, it just seems better if I can move it.
-
Hi,
Sure you can, just create a custom widget that will have these slots and contain all the needed "sub widgets" , nothing wrong with that at all. You can see it done in Qt's examples and demos
-
-
Did you made a separate widget with designer for each group box ?
-
I made a separate subclass of QGroupBox for each group box I use. I promotted each groupbox in Qt Creator to the respective subclass. I think I need to use connect to make it work, which seems to have been done automatically for me in the mainwindow scenario.
Sorry, but I have only been able to use Qt for a few days and I am still in the learning phase. I probably should wait longer before I post, but I'm just not sure of the language to know what to search for.
-
Then just take the documentation and search for Designer, you'll have several guides that will help you