Results 1 to 2 of 2

Thread: Why does Qt constantly print "couldn't create image from" for SVGs?

  1. #1
    Join Date
    Mar 2009
    Posts
    14
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Why does Qt constantly print "couldn't create image from" for SVGs?

    I would like to use SVGs in menus and buttons around a Qt-4.7 application. The images are rendered correctly across linux and windows platforms, however an obnoxious message reading...

    couldn't create image from ""

    ...is printed to the console seemingly as soon as one of these images is loaded or changes state (like highlighting or disabling its container widget). Over the course of the run of the application, many of these lines are printed, leaving a lot of senseless output crufted around reasonable application output.

    Poking around the Qt code a bit, this appears to be coming from svg/qsvghandler.cpp:2680 where the line contains the following.

    Qt Code:
    1. qDebug()<<"couldn't create image from "<<filename;
    To copy to clipboard, switch view to plain text mode 

    From the documentation for qDebug, you would think that I could block this by defining QT_NO_DEBUG_OUTPUT at compiletime, but this will only block the application's compiled debug calls, not the one in Qt's SVG library.

    So I guess my question is actually two-fold:

    1. As in the title, why is Qt printing this even when rendering SVGs correctly?
    2. Without recompiling Qt or its SVG library, how do I prevent Qt from printing this and crufting the application's output?


    I've also posted this question at stackoverflow.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Why does Qt constantly print "couldn't create image from" for SVGs?

    As in the title, why is Qt printing this even when rendering SVGs correctly?
    Have a look in the source for the conditions under which it prints that message. Clearly the filename is "" at that point. My guess is that your SVG file(s) has a bitmap image node (<image> element) that refers to a missing external file (or no file at all) rather than embedding the bitmap as base64 text.

Similar Threads

  1. Replies: 0
    Last Post: 12th November 2010, 12:32
  2. Replies: 4
    Last Post: 20th September 2010, 11:42
  3. How to create a "setup" wizard for my Qt Application ?
    By AbuYusuf in forum Installation and Deployment
    Replies: 1
    Last Post: 14th February 2010, 13:59
  4. How to create "extra" soft keys
    By jasper_ferrer in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 13th September 2009, 04:00
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05

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.