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 200657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:07:51+00:00 2026-05-11T17:07:51+00:00

I want to display a QListView where each item is a checkbox with some

  • 0

I want to display a QListView where each item is a checkbox with some label. The checkboxes should be visible at all times. One way I can think of is using a custom delegate and QAbstractListModel. Are there simpler ways? Can you provide the simplest snippet that does this?

Thanks in advance

  • 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-11T17:07:51+00:00Added an answer on May 11, 2026 at 5:07 pm

    If you are writing your own model, just include the Qt.ItemIsUserCheckable
    flag in the return value from the flags() method, and ensure that you return
    a valid value for the Qt.CheckStateRole from the data() method.

    If you use the QStandardItemModel class, include the Qt.ItemIsUserCheckable
    flag in those you pass to each item’s setFlags() method, and set the check
    state for the Qt.CheckStateRole with its setData() method.

    In an interactive Python session, type the following:

    from PyQt4.QtGui import *
    
    model = QStandardItemModel()
    item = QStandardItem("Item")
    item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
    item.setData(QVariant(Qt.Checked), Qt.CheckStateRole)
    model.appendRow(item)
    
    view = QListView()
    view.setModel(model)
    view.show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display a list view in my application. Each row should contain
I want to display a ListView in table format. The ListView should have rows
I am working on some ListView I want to display a Button under it
I have db with this table (TableToDo): http://goo.gl/NlTEk I want display all records in
I have a ListView where each item is a TextView . I want to
I have a ListView where I want to display items from more than one
I've implemented a listview (where each item is a buttom) and now I want
I want to create a ListView that contains Each item has an id and
I want to design each list item in the ListView can be clickable, and
i want to know how to remove underline in display listview in android, can

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.