I have created an interface for running inside another program using pyqt5.
for this I use the code that I put at the end of the post. in any case, as it can be seen there are several lines of the gridLayout that are created over a loop (for i in range(0,7):
), the issue comes from this, the number of lines in this section (in the example 7), it is dependant of external variables and can be equal to a N numbers. when N is too big the created window is bigger than the screen and I can no change the option for the not visible lines, nor acept/cancel the window. I am seeking help in trying to solve this issue, I was looking to add an scroable section (for the lines of the for loop) of a 4 or 5 height of lines (of the gridLayout) and that has an scroable bar that I can go down with it to see the different lines of created within the loop. but i could not make it work nor find a correct tutorial that explains this.
I also add a screenshot of what i have now and a mockup of what I am looking to do:
def fun_1():
print('a')
def fun_2():
print('a')
def fun_3():
print('a')
from PyQt5.QtWidgets import QWidget, QMessageBox
from PyQt5 import QtCore, QtGui
import PyQt5.QtCore as QtCore
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt
dialog = QDialog()
dialog.resize(550,50)
dialog.setWindowTitle("Input size")
layout = QGridLayout(dialog)
counter=0
checkBox=QCheckBox('checkBox')
checkBox.setChecked(1)
layout.addWidget(checkBox,counter,0,1,5)
checkBox.stateChanged.connect(fun_1)
label_ratio=QLabel('<b>Label 1:</b>')
layout.addWidget(label_ratio,counter,4,1,1)
label_ratio.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
inputsLines_1=[[] for i in range(0,8)]
inputsLines_1[-1]=QLineEdit("value")
layout.addWidget(inputsLines_1[-1],counter,5,1,4)
counter=counter+1
sepBar_1=QLabel("<b>======================================================================================================================</b>")
layout.addWidget(sepBar_1,counter,0,1,8)
counter=counter+1
title=QLabel("<b>Group i</b>: [min, max]<b>*</b>")
layout.addWidget(title,counter,1,1,1)
aclaration3=QLabel("<b>Show/Hide</b>")
layout.addWidget(aclaration3,counter,7,1,1)
counter=counter+1
sepBar_2=QLabel("<b>===================================================== [Group] =====================================================</b>")
layout.addWidget(sepBar_2,counter,0,1,8)
counter=counter+1
combobox=[[] for i in range(0,7)]
comboboxCurrentItem=[[] for i in range(0,7)]
label_1=[[] for i in range(0,7)]
label_1CurrentItem=[[] for i in range(0,7)]
inputsLines_1=[[] for i in range(0,7)]
inputsLines_1CurrentItem=[[] for i in range(0,7)]
label_2=[[] for i in range(0,7)]
label_2CurrentItem=[[] for i in range(0,7)]
inputsLines_2=[[] for i in range(0,7)]
inputsLines_2CurrentItem=[[] for i in range(0,7)]
checkBoxShowHide=[[] for i in range(0,7)]
option= ['option 1']
for i in range(0,7):
w = QLabel(" ")
w.setStyleSheet("background:rgb("+str(i)+");")
layout.addWidget(w,counter,0,1,1)
groupLabel=QLabel("<b>Group "+str(i)+"</b>")
layout.addWidget(groupLabel,counter,1,1,1)
combobox[i]=QComboBox()
combobox[i].addItems(option)
combobox[i].setCurrentText(option[0])
comboboxCurrentItem[i]=combobox[i].currentText()
combobox[i].currentTextChanged.connect(fun_2)
layout.addWidget(combobox[i],counter,2,1,1)
label_1[i]=QLabel('a:')
label_1CurrentItem[i]=label_1[i].text()
layout.addWidget(label_1[i],counter,3,1,1)
inputsLines_1[i]=QLineEdit("0")
inputsLines_1CurrentItem[i]=inputsLines_1[i].text()
layout.addWidget(inputsLines_1[i],counter,4,1,1)
label_2[i]=QLabel('b:')
label_2CurrentItem[i]=label_2[i].text()
layout.addWidget(label_2[i],counter,5,1,1)
inputsLines_2[i]=QLineEdit(str(1))
inputsLines_2CurrentItem[i]=inputsLines_2[i].text()
layout.addWidget(inputsLines_2[i],counter,6,1,1)
checkBoxShowHide[i]=QCheckBox("")
checkBoxShowHide[i].setChecked(1)
layout.addWidget(checkBoxShowHide[i],counter,7,1,1)
checkBoxShowHide[i].setLayoutDirection(Qt.RightToLeft)
checkBoxShowHide[i].stateChanged.connect(fun_3)
counter=counter+1
aclaration=QLabel("<b>*:</b> aclaration")
layout.addWidget(aclaration,counter,0,1,4)
aclaration.setWordWrap(True)
counter=counter+1
sepBar_3=QLabel("<b>======================================================================================================================</b>")
layout.addWidget(sepBar_3,counter,0,1,8)
counter=counter+1
okbox = QDialogButtonBox(dialog)
okbox.setOrientation(QtCore.Qt.Horizontal)
okbox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
layout.addWidget(okbox,counter,4,1,4)
dialog.show()
I tried to add QScrollArea() without succes