layout - PyQt4 QHBoxLayout cell size issue -
i using pyqt4 qhboxlayout creat window multiply frame, here part of code
def initui(self): hbox = qtgui.qhboxlayout(self) topleft = qtgui.qframe(self) topleft.setframeshape(qtgui.qframe.styledpanel) topright = qtgui.qframe(self) topright.setframeshape(qtgui.qframe.styledpanel) bottom = qtgui.qframe(self) bottom.setframeshape(qtgui.qframe.styledpanel) splitter1 = qtgui.qsplitter(qtcore.qt.horizontal) splitter1.addwidget(topleft) splitter1.addwidget(topright) splitter2 = qtgui.qsplitter(qtcore.qt.vertical) splitter2.addwidget(splitter1) splitter2.addwidget(bottom) hbox.addwidget(splitter2) self.setlayout(hbox) self.setgeometry(300, 300, 300, 200) self.setwindowtitle('qtgui.qsplitter') self.show()
but output seems wired, because toplift , topright frame squeezed, wondering if there solve problem make height of toplift , topright same height of bottom.
from qt doc, qsplitter
has setsize
method:
void qsplitter::setsizes(const qlist<int> & list)
sets child widgets respective sizes values given in list.
if splitter horizontal, values set widths of each widget in pixels, left right. if splitter vertical, heights of each widget set, top bottom.
...
also, qwidget
, can use setminimumsize
.
Comments
Post a Comment