Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 604509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:02:47+00:00 2026-05-13T17:02:47+00:00

I am new to QT, I am facing some problems in inserting images to

  • 0

I am new to QT, I am facing some problems in inserting images to list view. This is my current code:

int main(int argc, char *argv[]) 
{
    QApplication a(argc, argv);

    QListWidget* list = new QListWidget();
    QListWidgetItem *item1 = new QListWidgetItem(QIcon(":\temp\boat.png"), "BlueHills", list);
    list->insertItem(0, item1);
    QListWidgetItem *item2 = new QListWidgetItem(QIcon("C:\\Documents and Settings\\admin\\Desktop\\icons\\car.png"), "Sunset", list);

    list->show();
}

The problem I have is only the text is being displayed.

How to insert image1

how to insert image2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:02:48+00:00Added an answer on May 13, 2026 at 5:02 pm

    I took your code and pasted it in a brand new QtCreator project and it works. I would suggest you double check your images’ paths.

    The path for the image of your first item should be “:/temp/boat.png”. Make sure that your image is clearly defined in your resource file. I would therefore suggest you to test with an image located in the root of C, for instance "C://mypic.png".

    You can add a resource file from within QtCreator using the New File or Project dialogue. The Qt Resource File is located under Files and Classes -> Qt

    The resulting file may look something like this:

    <RCC>
        <qresource prefix="images_section">
            <file alias="MyBoatImage">boat.png</file>
        </qresource>
    </RCC>
    

    If you choose to write it out, you need to add it your .pro file as such:

    RESOURCES += resource.qrc
    

    Whichever way you create the resource file, you can access its resources through something like: ":/images_section/MyBoatImage"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing some problems for using placement new for contiguous memory.Please guide me,
i'm new to pyqt , and i'm still facing some newbie problems :D i
i'm new to ASP.NET MVC and i'm facing some structural design problems. I can't
I am a new developer. I am facing some problems in my new app.
hi im new to jquery and im facing these problem i have these code
I'm facing some problems with the progress dialogs. I use a managed progress dialog
I'm facing this problem with Java. I want to get some HTML informations from
I'm facing some problems with java classes. Here is a class I defined public
I am trying to create website, now i m facing some problems like. Get
I am still facing some problems when using LINQ-to-SQL. I am also looking for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.