Results 1 to 5 of 5

Thread: Which out of QImage, QPixmap, and QPainter should be preferred for what reason?

  1. #1
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Which out of QImage, QPixmap, and QPainter should be preferred for what reason?

    In which case should we use which one for what reason?

    Please guide.

  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: Which out of QImage, QPixmap, and QPainter should be preferred for what reason?

    Please guide.
    Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture.

    - QImage is designed and optimized for I/O, and for direct pixel access and manipulation.
    - QPixmap is designed and optimized for showing images on screen.
    - QBitmap is only a convenience class that inherits QPixmap, ensuring a depth of 1.
    - QPicture class is a paint device that records and replays QPainter commands.

    This is only a heads up, rest can be found in Qt Docs

    In which case should we use which one for what reason?
    What is you case (aka requirement)?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

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

    TheIndependentAquarius (19th October 2013)

  4. #3
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Re: Which out of QImage, QPixmap, and QPainter should be preferred for what reason?

    Thanks for your reply.

    Quote Originally Posted by Santosh Reddy View Post
    What is you case (aka requirement)?
    Actually I have made something similar to this:
    http://programmingexamples.wikidot.c...ainter-example

    I wish to display those lines in a Rectangle in QML. The line's properties will be decided at run time.

    What should I prefer?

  5. #4
    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: Which out of QImage, QPixmap, and QPainter should be preferred for what reason?

    Have a look at QDeclarativeItem API and it should become perfectly clear what approach you should take. Hint: QDeclarativeItem is derived from QGraphicsItem which has a paint() method.
    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.


  6. The following user says thank you to wysota for this useful post:

    TheIndependentAquarius (20th October 2013)

  7. #5
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Re: Which out of QImage, QPixmap, and QPainter should be preferred for what reason?

    Thankful to you. I have another question now.

Similar Threads

  1. QPainter(&QPrinter) & QPainter(&QImage) communication
    By gufeatza in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2010, 07:25
  2. DIB to QImage or QPixmap
    By ^NyAw^ in forum Qt Programming
    Replies: 0
    Last Post: 8th August 2008, 20:18
  3. QTextEdit preferred height
    By darksaga in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2007, 02:03
  4. What's faster: QPixmap-to-QImage or QImage-to-QPixmap
    By forrestfsu in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2006, 17:11
  5. QImage or QPixmap?
    By Dark_Tower in forum Qt Programming
    Replies: 9
    Last Post: 1st April 2006, 17:08

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.