Please nominate your Qt Champions for 2021!

QAction icon is not showing in Qtoolbar

  • I have a problem with QToolbar and QAction. I'm trying to show an action with a icon but the icon is not showing.

    This is my qrc and code example (I'm using PySide2):

    <!DOCTYPE RCC><RCC version="1.0">
    <qresource prefix="/iconos">
        <file alias="vista-inicial.svg">iconos/cubo.svg</file>
        <file alias="cubo.png">iconos/3d.png</file>
        toolbar = QtWidgets.QToolBar()
        toolbar.setIconSize(QtCore.QSize(24, 24))
        accion_vista_inicial = QtWidgets.QAction(QtGui.QIcon(":/iconos/cubo.png"), "Vista Inicial", self)

    And finally a little screenshot:
    alt text

  • Does this icon show in a normal QToolButton?

  • Lifetime Qt Champion


    Might be a silly question but did you call pyside2-rcc to generate the python code for embedding your rcc stuff ?

Log in to reply