QWindow not displaying icon.



  • 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!



  • I found a workaround.

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

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


  • Lifetime Qt Champion

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.