I am trying to use QHBoxLayout for the following layout:

| m_widgetS | m_stackedWidget |

I want m_widgetS to be placed on the left hand side of a QStackedWidget populated with m_widgetA and later m_widgetB, m_widgetC, etc.
I am trying to create something similar to the KDE config dialogue, where I can switch widgets by selecting from a list on m_widgetS.
I am still using Qt 5 and my code looks like this:

m_widgetS = new WidgetS(this); // subclassed QWidget
m_widgetS->setStyleSheet("background-color: red"); // Make widgets visible

m_widgetA = new WidgetA(this); // subclassed QWidget
m_widgetA->setStyleSheet("background-color: blue");

m_stackedWidget = new QStackedWidget(this);
m_stackedWidget->addWidget(m_widgetA); // just one for now
m_stackedWidget->setCurrentWidget(m_widgetA);
m_stackedWidget->resize(400,600);

m_hBox = new QHBoxLayout(this);
m_hBox->addWidget(m_widgetS); // The static widget
m_hBox->addWidget(m_stackedWidget); // <-------
this->setLayout(m_hBox);

resize(600,600);

The strange thing is that the stacked widget covers the whole 600x600 area. If I comment out the line marked "// <-------" I can see the blue m_widgetA, now sized 400x600 and the red m_widgetS; that latter of size 600x600 and placed in front of the blue m_widgetA. The blue one is slightly higher than the red one (also strange), so I can see both. I have red the docs, but something must be wrong. Any ideas?