I'm doing a framework in python and Qt, and I have a question. Let's see if with some help I can solve it.
My question is this: when making a layout I want some buttons to form a vertical layout and others a horizontal layout, so the screen would not be too big and everything would be more organized. For now I am only able to create a vertical layout type and add everything to it.
I would like to do everything in a class, because this layout is part of a StackedWidget
and depending on the selected button, one or the other will be shown on the screen (which will be another different class).
This is what I have now:
But I would like something like this:
My current code is as follows:
class propiedades_ueye_class(QtGui.QWidget):
def __init__(self, parent=None):
super(propiedades_ueye_class, self).__init__(parent)
self.foto = QtGui.QPushButton('Foto')
self.preview = QtGui.QPushButton('Preview')
self.distancia = QtGui.QPushButton('Distancia')
self.livemode = QtGui.QPushButton('Live mode')
self.timelapse = QtGui.QPushButton('TimeLapse')
self.ejex = QtGui.QLineEdit()
self.ejey = QtGui.QLineEdit()
self.segundos= QtGui.QLineEdit()
self.nfotos = QtGui.QLineEdit()
self.lejex = QtGui.QLabel("Eje X")
self.lejey = QtGui.QLabel("Eje Y")
self.lsegundos = QtGui.QLabel("Segundos")
self.lfotos = QtGui.QLabel("Fotos")
self.centrado = QtGui.QCheckBox("Centrado")
self.mallado = QtGui.QCheckBox("Mallado")
self.definido = QtGui.QCheckBox("Definido")
self.reticulo = QtGui.QCheckBox("Reticulo")
layout = QtGui.QVBoxLayout()
layout.addWidget(self.lejex)
layout.addWidget(self.ejex)
layout.addWidget(self.lejey)
layout.addWidget(self.ejey)
layout.addWidget(self.centrado)
layout.addWidget(self.mallado)
layout.addWidget(self.definido)
layout.addWidget(self.foto)
layout.addWidget(self.preview)
layout.addWidget(self.distancia)
layout.addWidget(self.livemode)
layout.addWidget(self.reticulo)
layout.addWidget(self.lsegundos)
layout.addWidget(self.segundos)
layout.addWidget(self.lfotos)
layout.addWidget(self.nfotos)
layout.addWidget(self.timelapse)
self.setLayout(layout)