PDA

View Full Version : How to disable scroll bars in QPrintPreviewWidget?



manu_maithri
17th January 2014, 08:33
Hi All,

I am creating a customized print preview dialog.
In my dialog I am using QPrintPreviewWidget.
I am able to show my print preview. In case if the preview has multiple pages then a scrollbar comes up.
I need to disable the scroll bars which is provided by QPrintPreviewWidget. Any idea how to do this?
Sorry if this is a silly doubt, I am new to QT thats why.... :-)

Regards,
R Manu

ChrisW67
21st January 2014, 01:01
It is not directly exposed so you have to use QObject introspection to find the scroll area inside the preview widget:


QAbstractScrollArea *area = m_printPreview->findChild<QAbstractScrollArea*>();
if (area) {
area->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff) ;
}