I have 3 PlotWidget
(from the pyqtgraph
library), obj1
, obj2
and obj3
, which I try to insert in a QGridLayout. I want to display all three objects in a single row, but obj1
must be twice as large as obj2
and obj3
.
Thus I wrote:
layout.addWIdget(obj1, 0, 0, 1, 2)
layout.addWidget(obj2, 0, 2, 1, 1)
layout.addWidget(obj3, 0, 3, 1, 1)
However, visually, obj1
is much smaller than obj2
and obj3
which do have the same size:
---------------------------------------------------
| obj1 | obj2 | obj3 |
---------------------------------------------------
However, if I write:
layout.addWIdget(obj1, 0, 0, 1, 1)
layout.addWidget(obj2, 0, 1, 1, 6)
layout.addWidget(obj3, 0, 7, 1, 6)
obj1
appears bigger than obj2
and obj3
which are still of the same size, which is the expected behavior:
---------------------------------------------------
| obj1 | obj2 | obj3 |
---------------------------------------------------
It seems totally contradictory to the doc of addWidget as my first solution should yield the expected behavior, no?
EDIT: Piece of code
import pyqtgraph as qtg
obj1 = qtg.PlotWidget()
obj2 = qtg.PlotWidget()
obj3 = qtg.PlotWidget()
layout = QGridLayout()
layout.addWIdget(obj1, 0, 0, 1, 2)
layout.addWidget(obj2, 0, 2, 1, 1)
layout.addWidget(obj3, 0, 3, 1, 1)
box = QGroupBox()
box.setLayout(layout)
self.setCentralWidget(box)