Results 1 to 5 of 5

Thread: How to use verticalScrollBar? [SOLVED]

  1. #1
    Join Date
    Jul 2011
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to use verticalScrollBar? [SOLVED]

    I added scrollArea and verticalScrollBar but not functioning as I expected.
    Need code for it. What should I set? Value?
    I want the scrollBar to display unseen part of the page...
    Need help! >.<
    Last edited by micamica; 19th July 2011 at 07:09. Reason: updated contents

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to use verticalScrollBar?

    Just add you widget to the QScrollArea, and that's all you are done. vertical / horizontal scroll bars appear as and when needed. The basic example from documentation is

    Qt Code:
    1. QLabel *imageLabel = new QLabel; //replace this with your widget
    2. QImage image("happyguy.png");
    3. imageLabel->setPixmap(QPixmap::fromImage(image));
    4.  
    5. scrollArea = new QScrollArea;
    6. scrollArea->setBackgroundRole(QPalette::Dark);
    7. scrollArea->setWidget(imageLabel);//set your widget on to QScrollArea
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2011
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to use verticalScrollBar?

    tried it but nothing is display..
    Is there a code example for QT Designer?

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to use verticalScrollBar?

    here you go QScrollArea.zip

  5. The following user says thank you to Santosh Reddy for this useful post:

    micamica (19th July 2011)

  6. #5
    Join Date
    Jul 2011
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to use verticalScrollBar?

    Quote Originally Posted by Santosh Reddy View Post
    here you go QScrollArea.zip
    thanks that works !

Similar Threads

  1. [Qt3] Two QListviews - VerticalScrollBar Sync Problems
    By BrainB0ne in forum Qt Programming
    Replies: 0
    Last Post: 25th September 2008, 11:18
  2. verticalScrollBar on the left
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 10th August 2006, 15:32

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.