Results 1 to 6 of 6

Thread: To draw images in QLabel

  1. #1
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default To draw images in QLabel

    Hi all,

    I wanna use a QLabel and place two or three images on top of each other. And each image should be transparent to one another. And each image should fit in the label size provided.

    So that each image should be able to Zoom in and Zoom out at same ratio.

    How do i achieve this? ...I am putting my efforts by using Qpainter & composition mode to do this ...Still results are yet to achieve ...Kindly help me.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: To draw images in QLabel

    1. Subclass QWidget to create your own
    2. Use QGraphicsView

    One label = one pixmap (default)

  3. #3
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: To draw images in QLabel

    Quote Originally Posted by tbscope View Post
    1. Subclass QWidget to create your own
    2. Use QGraphicsView

    One label = one pixmap (default)

    Hi Scope,

    Any Example of doing with QGrpahicsView ...

    What does Label= Pixmap mean? only one image can be added to a label

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: To draw images in QLabel

    Quote Originally Posted by augusbas View Post
    Any Example of doing with QGrpahicsView ...
    http://doc.qt.nokia.com/4.7/examples-graphicsview.html

    What does Label= Pixmap mean? only one image can be added to a label
    Yes, if you use setPixmap, you can only add one pixmap at a time. Unless you subclass the label, but subclassing a QWidget would be easier.
    Or, you need to place three labels on top of eachother.

  5. #5
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: To draw images in QLabel

    Quote Originally Posted by tbscope View Post
    http://doc.qt.nokia.com/4.7/examples-graphicsview.html


    Yes, if you use setPixmap, you can only add one pixmap at a time. Unless you subclass the label, but subclassing a QWidget would be easier.
    Or, you need to place three labels on top of eachother.
    But with image composition example in /examples/painting it is proven of mixing two images and setting through pixmap to a Qlabel.... Am i Right?

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: To draw images in QLabel

    Then use that example.

Similar Threads

  1. Replies: 1
    Last Post: 29th September 2009, 19:44
  2. Replies: 6
    Last Post: 21st September 2009, 10:55
  3. Qt Draw fast png images
    By anafor2004 in forum Newbie
    Replies: 4
    Last Post: 4th November 2008, 09:28
  4. How can I draw on Qlabel
    By validator in forum Qt Programming
    Replies: 4
    Last Post: 4th August 2008, 08:58
  5. Images in QLabel
    By qball2k5 in forum Qt Programming
    Replies: 5
    Last Post: 6th March 2006, 21:28

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.