Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-118667

QIcon::addFile() with an invalid filename results in QFile::isNull() == false

XMLWordPrintable

    • 5a5c96c65 (dev), 9a08abf41 (6.6), e3e07f4c6 (tqtc/lts-6.5), 2bccacab2 (dev), 83d87c956 (6.6), 64d874c45 (tqtc/lts-6.5)

      During my cleanup of the icon stuff within QCommon/Fusion style I found that QFile::addIcon() with an invalid filename creates a non-null QIcon instance even if the filename is not found.

      QIcon icon;
      icon.addFile("non-existing-icon.png");
      if (icon.isNull())
        qDebug() << "Null icon!" << icon;
      else
        qDebug() << "Valid icon!" << icon;
      

      I'm not quite sure if this is by accident or a simple oversight. I would expect that this results in a null QIcon.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            vgt Eirik Aavitsland
            chehrlic Christian Ehrlicher
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes