Results 1 to 3 of 3

Thread: problem with ported canvas example

  1. #1
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question problem with ported canvas example

    Hi all,

    I was trying to use a loaded image on a QT4 GraphicScene in my own code,
    and had some problems, so I started working with the Ported Canvas
    example to understand a minimum function.

    I found what looks like a problem with that example.
    In the ImageItem constructor, if I leave the QT3 API as
    it is:
    pixmap.convertFromImage(image);

    The butterfly image displays successfully.

    If I try to convert that call to the QT4 api like this:
    pixmap.fromImage(image);

    The butterfly images do not display.
    The rest of the code is the same, and there are no
    compile time or run time warnings or errors.

    I'm really stumped.
    Please help!

    -Don

  2. #2
    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: problem with ported canvas example

    QPixmap::fromImage() is a static call returning a pixmap, You have to assign the result to a pixmap variable.
    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.


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

    bajarangi (29th July 2009)

  4. #3
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Smile Re: problem with ported canvas example

    Thanks Wysotta!

    Of course it now works fine.

    I pledge to read the API documentation more carefully in the future.

    -Don

Similar Threads

  1. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Tags for this Thread

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.