Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Subbed QFileIconProvider, set it to return only one icon, makes no difference

Subbed QFileIconProvider, set it to return only one icon, makes no difference

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 768 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Moschops
    wrote on last edited by
    #1

    I have a pretty standard QFileDialog that I am using to have the user select a directory, and because I want to be able to change the icons seen, I have subclassed QFileIconProvider and am using my own function to provide the icon. Like this:

    @ subbedFileIconProvider tempIconprovider;
    QFileDialog aFileDialog;
    aFileDialog.setIconProvider(&tempIconprovider);
    QString dir = aFileDialog.getExistingDirectory(0, tr("Select directory"),
    QString(),
    QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);@

    The subbedFileIconProvider contains an icon function, like this:

    @QIcon subbedFileIconProvider::icon(const QFileInfo &info) const
    {
    return QIcon(":/workplace/customIcon");
    }@

    I know it's being called as I set a breakpoint there and watch it being called repeatedly. However, the file dialog looks exactly the same. No change. So what am I missing? I though I could control the icon that would be displayed on screen in the file selection dialog, but it makes no difference at all.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Your icon provider is not used, getExistingDirectory is a static function so you are not using the file dialog you think you are using

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved