PDA

View Full Version : QTabWidget adjust internal Widget to fit full size



^NyAw^
24th December 2009, 12:57
Hi,

I'm creating a QTabWidget and adding a QScrollArea into it. I want the QScrollArea to fit all the avaiable space. How can I do it?

Thanks,

Lykurg
24th December 2009, 13:26
Maybe I get you wrong, but what about using a layout inside a tab page? QHBoxLayout.

^NyAw^
24th December 2009, 13:32
Hi,

This is the code that I'm using:


m_pqTabWidget = new QTabWidget(m_pqParametersDock);
m_pqParametersDock->setWidget(m_pqTabWidget);

m_pqScrollAreaConfig = new QScrollArea();
m_pqScrollAreaConfig->setWidgetResizable(false);
m_pqTabWidget->addTab(m_pqScrollAreaConfiguracio,QString("Configuration"));


Have I to create a QWidget as the internal Widget of the QTabWidget, then add a layout to it where I will add the QScrollArea?

Thanks,

Lykurg
24th December 2009, 16:45
Your code works fine for me. Only be careful that m_pqScrollAreaConfig != m_pqScrollAreaConfiguracio. Maybe that's the error?

^NyAw^
25th December 2009, 01:20
Hi,



Only be careful that m_pqScrollAreaConfig != m_pqScrollAreaConfiguracio. Maybe that's the error?

It's only a copy paste mistake.



Your code works fine for me

I use a QWidget into the QScrollArea that grows depending on some data that it have to show(it add some custom widgets). This internal widget is deleted when I need to fill up new different data. Then, the tabs that have showed the scrolls of the QScrollArea still show them and I don't want it.

Thanks,