Dear Friends
I am using a QScrollArea which I can see some contents in it. By using the following code snippet I am able to see both the vertical and horizontal scrollbar. I am also implementing the virtual function
#include <QScrollArea>
{
Q_OBJECT
Public:
virtual ~PageForGraph();
};
PageForGraph
::PageForGraph(QWidget *parent
){
verticalScrollBar()->setRange(0, 2 * desk->height());
horizontalScrollBar()->setRange(0, 2 * desk->width());
}
void PageForGraph::scrollContentsBy(int dx, int dy)
{
widget()->move(widget()->x() + dx, widget()->y() + dy);
const int x = horizontalScrollBar()->value() + dx;
horizontalScrollBar()->setValue( x );
const int y = verticalScrollBar()->value() + dy;
verticalScrollBar()->setValue( y );
update();
}
#include <QScrollArea>
Class PageForGraph : public QScrollArea
{
Q_OBJECT
Public:
PageForGraph(QWidget *parent=0);
virtual ~PageForGraph();
};
PageForGraph::PageForGraph(QWidget *parent)
{
verticalScrollBar()->setRange(0, 2 * desk->height());
horizontalScrollBar()->setRange(0, 2 * desk->width());
}
void PageForGraph::scrollContentsBy(int dx, int dy)
{
widget()->move(widget()->x() + dx, widget()->y() + dy);
const int x = horizontalScrollBar()->value() + dx;
horizontalScrollBar()->setValue( x );
const int y = verticalScrollBar()->value() + dy;
verticalScrollBar()->setValue( y );
update();
}
To copy to clipboard, switch view to plain text mode
But when I moving the scrollbar my contents are not moving. Any help would be highly appreciated. Thanks sujan
Bookmarks