Results 1 to 7 of 7

Thread: Constructing QImage from QBytearray

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2008
    Posts
    74
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Constructing QImage from QBytearray

    Hi

    I am reading a raw binary data from a file into QBytearray. I want to use the QBytearray to construct a QImage. My code is shown below.

    Qt Code:
    1. QFile fileIn (fileName);
    2. fileIn.open(QFile::ReadOnly);
    3. QByteArray data = fileIn.readAll();
    4. QImage img(2048,1024,QImage::Format_Indexed8);
    5. img = QImage::fromData(data,QImage::Format_Indexed8);
    6. QPixmap qp=QPixmap::fromImage(img);
    7. BPlaneIN->setPixmap(qp);
    To copy to clipboard, switch view to plain text mode 

    error: conversion from `QByteArray' to `const uchar*' is ambiguous
    Could some tell me why I get this error message. I have used scanline to get this working but am confused as to why this method of loading the buffer doesnt

    Regards
    Last edited by jpn; 18th December 2008 at 16:12. Reason: missing [code] tags

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 16:37
  2. QImage to QByteArray
    By navi1084 in forum Qt Programming
    Replies: 5
    Last Post: 15th October 2008, 09:36
  3. QImage to QString
    By navi1084 in forum Qt Programming
    Replies: 2
    Last Post: 7th October 2008, 07:29
  4. Multiple QPainters on QImage
    By fire in forum Qt Programming
    Replies: 3
    Last Post: 14th August 2008, 13:10
  5. QShared
    By sabeesh in forum Qt Programming
    Replies: 11
    Last Post: 11th October 2007, 12:40

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.