Results 1 to 3 of 3

Thread: Save qpixmap to file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Save qpixmap to file

    you can use this code for Qt Assistant to save a pixmap in a QBuffer
    Qt Code:
    1. ...
    2. QPixmap pixmap;
    3. QByteArray bytes;
    4. QBuffer buffer(&bytes);
    5. buffer.open(QIODevice::WriteOnly);
    6. pixmap.save(&buffer, "PNG");
    7. ...
    To copy to clipboard, switch view to plain text mode 
    then you can convert QByteArray to base64 (using QByteArray::toBase64) and store in xml.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  2. The following 2 users say thank you to spirit for this useful post:

    AcerExtensa (12th June 2009), nightghost (18th April 2011)

Similar Threads

  1. How to save file with QFileDialog
    By pnikolov in forum Qt Programming
    Replies: 11
    Last Post: 1st June 2012, 10:23
  2. Rendering QGraphicsScene to QPixmap to save
    By Rooster in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2009, 05:24
  3. How set default file to save in QFileDialog
    By estanisgeyer in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2009, 12:09
  4. Restrict user from entering space in Save As File Name
    By jyoti kumar in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2007, 12:47
  5. How to check a file for changes since last save
    By nmather in forum General Programming
    Replies: 2
    Last Post: 21st April 2007, 23:43

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.