Results 1 to 7 of 7

Thread: QPixmap not displayed on windows / no proble on Linx -> Qt Bug or not?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2006
    Posts
    3
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QPixmap not displayed on windows / no proble on Linx -> Qt Bug or not?

    To use QPixmap is the only way I know to do what I want to do. That is showing an image in a QScrollView. When the image is zoomed in you can scroll that image to any position wanted. I am not an expert with using Qt, rather an intermediate. And doing that QImage->QPixmap->QLabel - "trick" looked strange to me but that is what I was told to do in order to get the wanted results.
    Guido

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

    Default Re: QPixmap not displayed on windows / no proble on Linx -> Qt Bug or not?

    How about using QPainter::drawImage() instead? And QPainter::scale() for zooming?

    If you have a 300x300 pixel image which occupies about 100kB of memory and you zoom it 4 times (making it 1200x1200) you'll use 1.5MB of memory... with 3000x3000 it'll be 9MB, etc. If you use QPainter::scale and QPainter::drawImage, you'll be at 100kB memory usage all the time.

  3. #3
    Join Date
    Jan 2006
    Posts
    109
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Default Re: QPixmap not displayed on windows / no proble on Linx -> Qt Bug or not?

    A QImage lives in your system's main memory and can therefore be quite large.

    A QPixmap is handled by the graphics subsystem of your computer and there are limitations on the size of pixmaps that can be handled. This is not a Qt issue.

    What you want is to load an image into a QImage (or some other custom specialized structure) in main memory. Then you extract/transform/zoom whatever part of the QImage you need to display, transforming it into a QPixmap and always trying to keep the pixmap a reasonable size. Again, this limitation is not related to Qt.

    Now, instead of programming all that by yourself, you could reuse code from existing Qt or KDE high-level widgets that display images and can handle rotations, zooming, shearing, etc.

    I don't have links to such programs right now, except maybe GRASS/Qt, but you'll probably be interested in A Zoomable Picture Viewer.

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
  •  
Qt is a trademark of The Qt Company.