layout - Qt4.8 The effect of setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding) When I using QGridLayout -


i want slice main windows slice main windows 10 sub-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: bad result

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

Popular posts from this blog

css - Text drops down with smaller window -

php - Boolean search on database with 5 million rows, very slow -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -