Widgets proportions in QSplitter



  • I have QListWidget and QTextBowser aligned vertically inside QSplitter, QListWidget on the top and QTextBowser at the bottom. I want to have QListWidget occupy 1/3 of the available space and QTextBowser occupy remaining 2/3 at the start. Later user may change widget sizes as he wants by dragging QSplitter border.

    UI was created with the QtDesigner, so I set verticalStretch property of the QListWidget to 1 and verticalStretch property of the QTextBrowser to 2. But this does not help, when I run application QSplitter space divided between both widgets in equal proportions.

    I also tried to set proportions programmatically using following code

    self.splitter.setStretchFactor(0, 1)
    self.splitter.setStretchFactor(1, 2)
    

    but it also does not work.

    Am I miss something or doing something wrong? Any ideas how to make top widget 2 times smaller than bottom widget?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.