python - QGridLayout, expand widget on the line -


i have qgridlayout handle widgets. fact stay in column put them, without expanding on whole width. there option tell rows expand ? goal mimic behavior of qhboxlayout, without using one.

example:

self.label_player = qtgui.qlabel("chemin du lecteur :") self.line_path = qtgui.qlineedit() self.button_select_player = qtgui.qpushbutton("sélectionner")  ...some code  self.grid_settings.addwidget(self.label_player, 3, 0, 2, 1) self.grid_settings.addwidget(self.line_path, 3, 1, 1, 1) self.grid_settings.addwidget(self.button_select_player, 3, 2, 1, 1) 

edit:

here image of want, obtained result qhboxlayout in qgridlayout, line in red (what try without):

http://i.imgur.com/hnnhjlp.png

and here 1 default behavior of qgridlayout. it's have:

http://i.imgur.com/xvqy5ai.png

import sys pyside import qtgui, qtcore  class window(qtgui.qwidget):     def __init__(self):         super(window, self).__init__()         self.grid = qtgui.qgridlayout()         big_one = qtgui.qpushbutton('big one')         big_one.setsizepolicy(qtgui.qsizepolicy.expanding, qtgui.qsizepolicy.expanding)         self.grid.addwidget(big_one, 0, 0, 2, 2)         self.grid.addwidget(qtgui.qpushbutton('ajouter'), 0, 2, 1, 1)         self.grid.addwidget(qtgui.qpushbutton('enlever'), 1, 2, 1, 1)         self.grid.addwidget(qtgui.qlabel("chemin du lecteur :"), 2, 0, 1, 1)         self.grid.addwidget(qtgui.qlineedit(), 2, 1, 1, 1)         self.grid.addwidget(qtgui.qpushbutton("selectionner"), 2, 2, 1, 1)         self.grid.addwidget(qtgui.qcheckbox("some long text in french"), 3, 0, 1, 3)         self.grid.addwidget(qtgui.qcheckbox("an longer text in french first one"), 4, 0, 1, 3)         self.grid.addwidget(qtgui.qlabel("something, something, something"), 5, 0, 1, 2)         self.grid.addwidget(qtgui.qspinbox(), 5, 2, 1, 1)         self.setlayout(self.grid)  app = qtgui.qapplication(sys.argv) w = window() w.show() sys.exit(app.exec_()) 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -