spyder-ide / qtawesome

Iconic fonts in PyQt and PySide applications

Home Page:https://qtawesome.readthedocs.io/en/latest/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to size icon inside qta.IconWidget

polygonalize opened this issue · comments

I looked at the usage example to see how I could size an icon without putting it in a button widget and this works:

spin_widget = qta.IconWidget()
spin_icon = qta.icon('mdi.loading', color='red',
                     animation=qta.Spin(spin_widget))
spin_widget.setIcon(spin_icon)
spin.widget.setIconSize(QSize(128, 128))

But if I try to add my an icon without animations, I cannot get the desired size. It will show in its default size. For example, this code will not show the icon in the size I desire:

spin_widget = qta.IconWidget()
spin_icon = qta.icon('mdi.loading', color='red')
spin_widget.setIcon(spin_icon)
spin.widget.setIconSize(QSize(128, 128))

Is there a workaround that doesn't require setting the icon in a QPushButton?

Hi @diagonalize thanks for the feedback! Checking seems like for actually applying the size change the update method should be call (and I think that's why using an animation enables to actually resize the icon). Could you try to call spin.widget.update() and see if that helps? Let us know!

Hello @dalthviz. The update() method did indeed fix my issue.

Thank you very much!