I can successfully get the layout correctly with the code below, how can I resize this QGridLayout horizontally and vertically?
self._s_q0= QLabel(u'what is your favorite color?')
self._e_q0 = QLineEdit(self)
self._e_q0.setText("yellow is the best color I can think of")
self._s_q1= QLabel(u'what is your favorite animal?')
self._e_q1 = QLineEdit(self)
self._e_q1.setText("cat or dog")
self._s_q2= QLabel(u'do you like swimming?')
self._e_q2 = QLineEdit(self)
self._e_q2.setText("not at all")
self._s_q3= QLabel(u'what date is it today?')
self._e_q3 = QLineEdit(self)
self._e_q3.setText("i dont know, you can ask Tom, he has a cellphone with him right now")
self._groupData = QGroupBox("100 questions list", self)
self._groupData_layout = QGridLayout()
self._groupData.setLayout(self._groupData_layout)
self._groupData_layout.addWidget(self._s_q0, 0, 0)
self._groupData_layout.addWidget(self._e_q0, 0, 1)
self._groupData_layout.addWidget(self._s_q1, 1, 0)
self._groupData_layout.addWidget(self._e_q1, 1, 1)
self._groupData_layout.addWidget(self._s_q2, 2, 0)
self._groupData_layout.addWidget(self._e_q2, 2, 1)
self._groupData_layout.addWidget(self._s_q3, 3, 0)
self._groupData_layout.addWidget(self._e_q3, 3, 1)
-----------------------
Add more description. I can get the layout correctly, the layout generated by code now is like below.
The width of this layout is too wide, how can I resize it smaller but not change the font size, how can I add a scorll bar to this QGridLayout?
Same for height, there are 100 questions, QGridLayout will be too long to show them all. How can I resize the height of QGridLayout, scroll bar?
Below image is the final result I want
Only show partial of the layout to save space for UI. Drag scroll bar to show other part of this layout. I don't know how to do it in code, just edit picture with paint.