Results 1 to 3 of 3

Thread: Moving the horizontal QScrollbar of a QScrollArea at the top of the QScrollArea

  1. #1
    Join Date
    Mar 2008
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Post Moving the horizontal QScrollbar of a QScrollArea at the top of the QScrollArea

    Hello!

    I need to move the position of the horizontal scroll bar of a QScrollArea at the top of the widget. Is there anyone who know how to do this?

    Thanks,
    py

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Moving the horizontal QScrollbar of a QScrollArea at the top of the QScrollArea

    Yes, it's quite simple. You need to subclass the widget, set viewport margins (using QAbstractScrollArea::setViewportMargins)so that the margin is in the top and not in the bottom of the viewport and reimplement resizeEvent() where you will have to reposition the horizontal scrollbar after every resize of the widget. Be aware of the fact that hiding and showing the scroll bar will probably require a bit more work to keep the viewport margins coherent.

  3. #3
    Join Date
    Mar 2008
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Moving the horizontal QScrollbar of a QScrollArea at the top of the QScrollArea

    Thanks wysota,

    I'll try that this week and I will let you know the outcomes..

    py

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.