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. QIcon problem
Qt 6.11 is out! See what's new in the release blog

QIcon problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 330 Views
  • 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.
  • I Offline
    I Offline
    Ileana
    wrote on last edited by
    #1

    I have a problem when declaring QIcon, I want to add images to a QlistWidget and enter this QListWidgetItem item= new QListWidgetItem(QIcon(":/img/imagenes/img/waffles.png"),"Desayunos"); but I get this error error: no viable conversion from 'QListWidgetItem *' to 'QListWidgetItem'
    I also get an error that says QIcon not initialized
    I do not know if I am missing a library or any statement, please I hope they help me: c

    1 Reply Last reply
    -1
    • nageshN Offline
      nageshN Offline
      nagesh
      wrote on last edited by
      #2

      @Ileana said in QIcon problem:

      QListWidgetItem item= new QListWidgetItem(QIcon(":/img/imagenes/img/waffles.png"),"Desayunos");

      Variable should be pointer to item as it's allocated on heap using new.
      QListWidgetItem *item = new QListWidgetItem(QIcon(":/img/imagenes/img/waffles.png"),"Desayunos");

      I 1 Reply Last reply
      1
      • nageshN nagesh

        @Ileana said in QIcon problem:

        QListWidgetItem item= new QListWidgetItem(QIcon(":/img/imagenes/img/waffles.png"),"Desayunos");

        Variable should be pointer to item as it's allocated on heap using new.
        QListWidgetItem *item = new QListWidgetItem(QIcon(":/img/imagenes/img/waffles.png"),"Desayunos");

        I Offline
        I Offline
        Ileana
        wrote on last edited by
        #3

        @nagesh Thank you :3 it has helped me.

        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