Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add ScrollBars to QGLWidget window?
Forum Updated to NodeBB v4.3 + New Features

How to add ScrollBars to QGLWidget window?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mathi77in
    wrote on last edited by
    #1

    Hi,
    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.

    Regards,
    M.Mathi

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Taamalus
      wrote on last edited by
      #2

      not sure if this helps, since it does not directly answer your question.

      http://qt-project.org/doc/qt-4.8/qgraphicsscene.html
      http://qt-project.org/doc/qt-4.8/graphicsview.html
      and simply use OpenGL Rendering.

      The other way is to address the parent QWidget and set it's scroll bars
      http://qt-project.org/doc/qt-4.8/qscrollarea.html

      ... time waits for no one. - Henry

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mkuettler
        wrote on last edited by
        #3

        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 .

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved