layout - Qt4.8 The effect of setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding) When I using QGridLayout -
i want slice main windows
my layout code follow:
qgridlayout *glayout = new qgridlayout (); viewwidget->setstylesheet("background-color: #333;" ); ( = 0; < m_numofvideowidget; i++) { qwidget *vwidget = new qwidget(viewwidget); vwidget->setsizepolicy(qsizepolicy ::expanding , qsizepolicy ::expanding ); videolist.append( vwidget); } index = 0; ( j = 0; j < 4; j += 2) { glayout->addwidget( videolist[ index++], 0, j, 2, 2); } ( = 2; < 4; i++) ( j = 0; j < 4; j++) glayout-> addwidget( videolist[ index++], i, j); viewwidget->setlayout(glayout );
unfortunately, result far expectation:
but when remove bellow sentence:
vwidget->setsizepolicy(qsizepolicy ::expanding , qsizepolicy ::expanding );
the result expected.
why
setsizepolicy(qsizepolicy ::expanding , qsizepolicy ::expanding );
can affect qgridlayout?
thanks~
it seems not set sizepolicy of vwidget, rather, of "this" widget. intention?
my guess grid layout tries effect size policy sum of size policies of contents, while setting size policy of "this" widget sort of interferes this.
Comments
Post a Comment