PDA

View Full Version : vertical scrollbar subtraction from the screen width



sujan.dasmahapatra
16th February 2011, 10:16
Dear Friends

I have a Qwidget and a QScrollBar is holding that widget using setWidget(widget) function.

When my screen is half some portion of the widget is getting out of scope so a scrollbar is coming. When the screen is full the widget can very well accommodated in the screen so I don’t want a scrollbar to come but its still coming for a very small variation. I came to know its because of the vertical scrollbars height itself. So when I set the geometry I am doing like this below


PageWidget::PageWidget(QScrollArea *parent)
{
desk = new QDesktopWidget;
page_width = desk->width();
page_height = desk->height();
setGeometry(0,0,page_width-pageforgraph->verticalScrollBar()->height(),hgth);
}
//////////////////////////////////////////////////////////////////////////////////
Now because of this code I can when my screen is full no scrollbar is coming. But just after the vertical scrollbar 1 very small portion of left…..I am subtracting only the height but some extra amount has been subtracted I think. Can anyone tell me how can I resolve this. I want only the exact amount of height of the scrollbar to be subtracted .
Please see the attachment picture. Look at the extreme right vertical scrollbar and some portion left after that. Any help would be appreciated. Thanks sujan