I solved the problem as follows:
instead of putting the layout directly in the ScrollArea, create a QWidget on which I put the layout QWidget and this is what I put in the ScrollArea.
the code is as follows:
ViewGraphics::ViewGraphics()
{
scroll = new QScrollArea(this);
widget = new QWidget(scroll);
layerH = new QHBoxLayout();
layerV = new QVBoxLayout(widget);
toolBar = new QToolBar("graphic");
button = new QAction(QIcon(":/images/registro.ico"),tr("&Example"), this);
button->setStatusTip(tr("Change palette"));
connect(button, SIGNAL(triggered()), this, SLOT(ChangePalette()));
toolBar->addAction(button);
layerV->addWidget(toolBar);
layerV->addLayout(layerH);
widget->setLayout(layerV);
scroll->setWidget(widget);
this->setWidget(scroll);
}
Bookmarks