Using a QPushButton to toggle the checkableBox of QGroupBox. How Possible is this please?
-
Hello great minds, I would need your contribution on this please if you are less busy and have an idea.
Python, PyQt5
I created a Window which has a groupbox on which the a VboxLayout which is like the parentLayout for my other widgets lie on.
Is there a way I can connect a button to control the gbox checkable method such that instead of me clicking that box with a tick sign, I can click on the button?
I am asking this because I want to write a function such that once the gbox is active (ticked for now), one can fill in the fields required by the widgets shown in it, but if disabled, only another layout be active for one to input data.Maybe the way I structure might sentence might be confusing, please just read it again and try to see what I am requesting for, then kindly suggest to me how to go about it if you have an idea about it or have done something similar to it before. Presently as it is, it is that small square box on the gbox on the displayed screen I can tick or untick which would either disable or enable the widget. I am looking for a way to use a button so at the click of the button, the gbox will be disabled, then a different layout enabled so I can input data. Then at the click of another button, the gbox layout would be enabled. Do you have an idea plz?
Attached to this post are screenshots of two different displays of my gbox Window. The checkbox of the gbox which is on top of the layout there is ticked and every component in the layout is enabled and active. In the other photo, the checked is not ticked, so every component in the layout is disabled and inactive.
I want a situation whereby when the gbox layout is disabled, another layout should be enabled where I can create another widget for retrieval of data.
<>class ...(QWidget): .def.... vbox = QVBoxLayout() glayt = QGridLayout gbox = QGroupBox() gbox.setCheckable(True) self.setLayout(glayt) glayt.addWidget(gbox) gbox.setLayout(vbox) ... scroll = QScrollArea() scroll.setWidget(gbox) scroll.setWidgetResizable(True) glayt.addWidget(scroll) </>
-
Hi
You can control the checkbox on the groupbox with
gbox.setChecked(true/false);
so your button can just call that to control it.If that is what you are asking ?