PDA

View Full Version : Qt resize child Window...



Peppy
10th December 2009, 17:35
Hi, I have this problem:
How to resize child tab widget which width must be 100% of MainWindow width...I tried: setGeometry(QRect(0,0,rect().width(),150)); But it just set up this width, when I resize window MainWindow, inherited by QMainWindow, then width is constant...do you have any solutions...I was looking on the google and nothing...

Peppy
10th December 2009, 18:18
Screens:
http://img99.imageshack.us/gal.php?g=scr1t.png

mhbeyle
10th December 2009, 20:44
I don't know if you want to do this but... Why don't you lay out the tab widget?

Peppy
10th December 2009, 21:34
It still doesn't work :(...I used QVBoxLayout and it doesn't work...do you have any idea how can I do it?

mhbeyle
10th December 2009, 22:51
It still doesn't work :(...I used QVBoxLayout and it doesn't work...do you have any idea how can I do it?

I think that your code is incomplete.

This works for me:



horizontalLayout = new QHBoxLayout();
tabWidget = new QTabWidget();
tab = new QWidget();
tabWidget->addTab(tab, QString());
tab_2 = new QWidget();
tabWidget->addTab(tab_2, QString());
horizontalLayout->addWidget(tabWidget);

Then you can set sizePolicy and/or max-min Size for the tabWidget (or add vertical spacer) if you don't want to lay out all the height.

Peppy
12th December 2009, 13:36
It doesn't help me. :(

squidge
12th December 2009, 13:53
It doesn't help me. :(In what way?