Web lists-archives.com

Re: setWindowIcon for QDialog

On Sun, Mar 3, 2019 at 11:00 AM Alexander Semke <alexander.semke@xxxxxx> wrote:
> Hi,
> in LabPlot we have couple of modal dialogs, created on the heap and shown with
> dlg->exec().  The dialog icon is set in the constructor of the dialog via
> QDialog::setWindowIcon(), e.g.
> setWindowIcon(QIcon::fromTheme(QLatin1String("labplot-worksheet")));
> The icon is set/handled by the window manager if I understand this correctly.
> With kwin, the specified icons are not shown and I always get the default
> application's icon shown. On windows, this seems to work and I see the proper
> icons in the dialogs.
> I tried to quit the event loop with
> QTimer::singleShot(0, this, [=] () {
>     setWindowIcon(QIcon::fromTheme(QLatin1String("labplot-worksheet")));
> });
> in order to call QDialog::setWindowIcon() after QDialog::show() but this
> doesn't help.
> So, what is the proper way to set the icon that would work everywhere?

Adding kwin in case they know.