Results 1 to 2 of 2

Thread: Use QAbstractScrollArea viewport's to display an image

  1. #1

    Default Use QAbstractScrollArea viewport's to display an image

    Hi forum!

    I want to use QAbstractScrollArea to display an image and scroll through its contents. I chose it because I'm making a paint-like application, which must support zoom feature, etc.; therefore, I think the ability to override some of QAbstractScrollArea's methods specifically might be better than to use QScrollArea with QLabel with an image as its widget. But now it seems to me like I would have to use QLabel anyway, and the viewport will give a view of it. So the question is, was it a good choice?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,023
    Thanks
    280
    Thanked 819 Times in 808 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Use QAbstractScrollArea viewport's to display an image

    I don't think it makes much difference whether you use QAbstractScrollArea or QScrollArea. QScrollArea does not add much to the core functionality of QAbstractScrollArea.

    However, it you are developing a paint-style application, I do not think you want to use a QLabel. QLabel is designed pretty much for non-interactive display of text and images. Since your users will be interacting with the image, you probably want to implement your own QWidget-based class where you have control over what happens in response to mouse, keyboard, paint, and other events.

    If you haven't done so already, be sure to look at Qt's Painting Examples.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 0
    Last Post: 10th February 2018, 10:40
  2. Replies: 1
    Last Post: 18th October 2015, 12:06
  3. QAbstractScrollArea forces repainting the whole viewport
    By Charletes in forum Qt Programming
    Replies: 9
    Last Post: 8th December 2010, 12:25
  4. Replies: 1
    Last Post: 3rd October 2007, 07:34

Tags for this Thread

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.