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. QWindow not displaying icon.
Qt 6.11 is out! See what's new in the release blog

QWindow not displaying icon.

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.2k 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
    mrjones
    wrote on last edited by
    #1

    Hello,

    My application consists of a single QWindow. It just does graphics rendering so I don't need menus, widgets etc. In some circumstances it is launched as a second window from within another application.

    I have added an icon but I can't get it do display. What am I doing wrong?

    I have a resource file. I use other PNG images from this file elsewhere, and they work.
    The icon itself loads OK :
    @
    MyWindow::MyWindow()
    : QWindow()
    , ic(":/img/icon.png")
    {
    setIcon(ic); // icon doesn't change

    QPixmap p = ic.pixmap(QSize(16,16));
    p.save("icon.png");    // 16x16 version of icon saved OK.
    
    setTitle("blah");      // this works
    

    }
    @

    Thanks for any help!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjones
      wrote on last edited by
      #2

      I found a workaround.

      If you call setIcon() after show() it works.

      Looks like a bug in QWindow, or an undocumented function call ordering.

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

        Hi,

        I would say it sounds like a bug (I may be wrong) You could check the "bug report system":http://bugreports.qt-project.org to see whether it's something known and raise a bug with a minimal compilable example showing the behavior.

        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