Building Qt Gui from few classes together
<p>Below is a short example of my Gui. I am trying to split my Gui in few parts.
The elements of <em>InputAxis</em> should be on the same height (horizontal split) and <em>self.recipient</em> should be below them (vertical split).</p>

<p>In <em>InputAxis</em> I am trying to place a <em>QLineEdit</em> but in my Gui I don't see it.</p>

<pre><code>import sys
from PySide import QtCore
from PySide import QtGui

class InputAxis(object):
    def __init__(self):
        self.frame = QtGui.QFrame()
        self.input_interface = QtGui.QLineEdit()
        self.form_layout = QtGui.QFormLayout()

    def genAxis(self):
        self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.form_layout.addRow('&amp;Input:', self.input_interface)

        return self.frame

class Window(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self, parent = None)

        self.layout = QtGui.QVBoxLayout()
        self.form_layout = QtGui.QFormLayout()

        self.axes = list()
        self.axes.append(InputAxis())
        self.axes.append(InputAxis())

        self.splitter1 = QtGui.QSplitter(QtCore.Qt.Horizontal)
        for axis in self.axes:
            self.splitter1.addWidget(axis.genAxis())
        self.form_layout.addWidget(self.splitter1)

        self.setMinimumWidth(400)
        self.recipient = QtGui.QLineEdit(self)
        # Add it to the form layout with a label
        self.form_layout.addRow('&amp;Recipient:', self.recipient)
        # Add the form layout to the main VBox layout
        self.layout.addLayout(self.form_layout, 0)
        # Set the VBox layout as the window's main layout
        self.setLayout(self.layout)
        QtGui.QApplication.setStyle( QtGui.QStyleFactory.create('Cleanlooks') )

    def run(self):
        self.show()

def main():
    qt_app = QtGui.QApplication(sys.argv)
    window = Window()
    window.run()
    sys.exit(qt_app.exec_())

if __name__=="__main__":
    main()
</code></pre>

<p>the reason it did not work was this line:</p>

<pre><code>self.form_layout = QtGui.QFormLayout()
</code></pre>

<p>It should be:</p>

<pre><code>self.form_layout = QtGui.QFormLayout(self.frame)
</code></pre>

python qt pyqt pyside