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

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

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-118667
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes