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

QAction icon is not showing in Qtoolbar

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 774 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.
  • E Offline
    E Offline
    efdiloreto
    wrote on last edited by
    #1

    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>
    </qresource>
    </RCC>
    
        toolbar = QtWidgets.QToolBar()
        toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        toolbar.setIconSize(QtCore.QSize(24, 24))
    
        accion_vista_inicial = QtWidgets.QAction(QtGui.QIcon(":/iconos/cubo.png"), "Vista Inicial", self)
    
        toolbar.addAction(accion_vista_inicial)
    

    And finally a little screenshot:
    alt text

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      Does this icon show in a normal QToolButton?

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

        Hi,

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

        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