Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ScrollBar
Forum Updated to NodeBB v4.3 + New Features

ScrollBar

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.7k 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.
  • A Offline
    A Offline
    Ankit.k
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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.

      (Z(:^

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Ankit.k
        wrote on last edited by
        #3

        Can you elaborate, I am not getting it.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          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);
          @

          (Z(:^

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Ankit.k
            wrote on last edited by
            #5

            Thanks. I'll try that

            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