Results 1 to 2 of 2

Thread: QScrollArea that only scrolls vertically

  1. #1
    Join Date
    Jan 2013
    Posts
    16
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Android

    Default QScrollArea that only scrolls vertically

    I need a QScrollArea that only scrolls vetically. Horizontally, it should behave like a normal widget.

    I've seen this thread here: http://qt-project.org/forums/viewthread/13728

    However, the solution proposed there subclasses QScrollArea and manages the widget internally (it calls setWidget() in its constructor). I need something where the setWidget() can be called at a later time. The problem with this approach is that it sets an event filter on the widget, but if that can't be done in the constructor, I don't see where else a subclass can get access to the widget to install the filter.

    Additionally, the size of the widget may change dynamically.

    Any ideas?

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

    Default Re: QScrollArea that only scrolls vertically

    I think it can still be done. One way is to provide a separate call for installing the event filter on the subwidget. Another isbproviding a separate call for setting the subwidget. Yet another is to monitor the scroll area for children additions and when the subwidget appears, set the event filter.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QListView scrolls to top when rows inserted
    By woodtluk in forum Qt Programming
    Replies: 2
    Last Post: 8th October 2010, 17:26
  2. Q Scroll Area that scrolls??
    By hakermania in forum Newbie
    Replies: 6
    Last Post: 24th August 2010, 20:48
  3. Rezizing the Qlabels vertically
    By anju123 in forum Qt Programming
    Replies: 3
    Last Post: 3rd January 2008, 16:35
  4. QTreeWidget - scrolls to top when removing items
    By durbrak in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2006, 23:02
  5. How can I write vertically in a QPushbutton ?
    By castorvert in forum Qt Programming
    Replies: 1
    Last Post: 2nd April 2006, 22:27

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.