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

  • Home
  • SEARCH
  • 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 4008042
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:42:19+00:00 2026-05-20T08:42:19+00:00

I am using QT to create a chat messenger client. To display the list

  • 0

I am using QT to create a chat messenger client. To display the list of online users, I’m using a QListWidget, as created like this:

listWidget = new QListWidget(horizontalLayoutWidget);
listWidget->setObjectName("userList");
QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Expanding);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(listWidget->sizePolicy().hasHeightForWidth());
listWidget->setSizePolicy(sizePolicy1);
listWidget->setMinimumSize(QSize(30, 0));
listWidget->setMaximumSize(QSize(150, 16777215));
listWidget->setBaseSize(QSize(100, 0));
listWidget->setContextMenuPolicy(Qt::CustomContextMenu);

Users are shown by constantly refreshing the list, like this: (Note: There are different channels, with different userlists, so refreshing it is the most efficient thing to do, as far as I know.)

void FMessenger::refreshUserlist()
{
    if (currentPanel == 0)
        return;
    listWidget = this->findChild<QListWidget *>(QString("userList"));
    listWidget->clear();
    QList<FCharacter*> charList = currentPanel->charList();
    QListWidgetItem* charitem = 0;
    FCharacter* character;
    foreach(character, charList)
    {
        charitem = new QListWidgetItem(character->name());
        // charitem->setIcon(QIcon(":/Images/status.png"));
        listWidget->addItem(charitem);
    }
}

This has always worked perfectly. The line that I commented out is the one I have problems with: my current goal is to be able to display a user’s online status with an image, which represents whether they are busy, away, available, etc. Using setIcon() does absolutely nothing though, apparently; the items still show up as they used to, without icons.

I’m aware that this is probably not the way this function needs to be used, but I have found little documentation about it online, and absolutely no useful examples of implementations. My question is, can anybody help me with fixing this problem?

  • 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-20T08:42:20+00:00Added an answer on May 20, 2026 at 8:42 am

    This is how you may conduct your debugging:

    • Try the constructor that has both icon and text as arguments.
    • Try to use that icon in another context to ensure it is displayable (construct a QIcon with same argument and use it elsewhere, e.g. QLabel!).
    • Use icon() from the QListWidgetItem to receive back the icon and then look at that QIcon.
    • Create a new QListWidget, change nothing, and ordinarily add some stock items in your MainWidget’s constructor. See if the icons show up there.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PHP5 to create XML files. I have code like this: $doc =
I am trying to create a simple chat client using the red5 media server,
First, I am using .net 3.5. I want to create an online chat system
Given an Oracle table created using the following: CREATE TABLE Log(WhenAdded TIMESTAMP(6) WITH TIME
Goal: Create Photomosaics programmatically using .NET and C#. Main reason I'd like to do
Using Python's Imaging Library I want to create a PNG file. I would like
i create a chat application using Adobe FLEX, currently it is not implemented yet,
I'm trying to create a chat application with jQuery without having to using setTimeout
as all we know that we can create very simple chat using ajax timer
I am using AS3 to create a tween affect between multiple images that have

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.