I have a QDeclarativeView
that I want to put in a QScrollArea
the problem is that the scrollarea does not work. It doesnt matter how big I set the declarative view. I do not get the scrollbar it is like it cant tell that the view need a scrollbar. If i dont set setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); the scrollbar does not appear.
Parent are inserted in a borderlayout as the centralwidget – I use this layout http://qt-project.org/doc/qt-4.8/layouts-borderlayout.html
myWidgets *editWidget = new myWidgets(pathToExe,viewerMgr, this);
editWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
Here is myWidget:
QScrollArea* scroll = new QScrollArea();
view = new QDeclarativeView(this);
view->setSource(QUrl::fromLocalFile(path));
view->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
view->setResizeMode(QDeclarativeView::SizeViewToRootObject);
scroll->setWidget(view);
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scroll->setWidgetResizable(true);
I have tried different size on the content but it's like the qscrollview doesnt detect when my widget is bigger then the visible view of qscrollarea.
view->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
toview->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
I do get the scrollarea to work. But I cant use my zoom function. So I still have a problem to get this to work – Chaf