How to add ScrollBars to QGLWidget window?
I am writing a OpenGL program used for QGLWidget class.
But I don't know how to add scroll bars to the QGLWidget windows area. how to add scroll bar from vertical and horizontal.
please any sample code or url share.
not sure if this helps, since it does not directly answer your question.
and simply use OpenGL Rendering.
The other way is to address the parent QWidget and set it's scroll bars
The QScrollArea (see Taamalus' response) is a good solution if you want to scroll a big widget that does not fit into the space you have. But if your QGLWidget does fit the space, and it should draw different contents depending on the value of the scrollbars (which I assume), you need something different.
If that is the case I recommend using QAbstractScrollArea. It is an abstract class, so you need to inherit from it and implement some functions. There is a description about what you need to implement and an example at http://qt-project.org/doc/qt-4.8/qabstractscrollarea.html#details .