ScrollBar
-
I am not able to get a Scroll bar. I declared the QAbstractScrollBarPolicy in main.cpp and worked the commands given below
QAbstractScrollArea::setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);QAbstractScrollArea::setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
getting the following error
main.cpp:18: error: cannot call member function 'void QAbstractScrollArea::setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy)' without object -
This method is not intended for setting the scroll bar policy globally. You need to have a valid object and set it on that object.
-
If you have a, say, QGraphicsView in your application, you can use this method like this:
@
QGraphicsView *myView = new QGraphicsView(this);
myView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
@You cannot, however, call this method without object, it is not static:
@
// will not work!
QAbstractScrollArea::setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
@