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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:25:15+00:00 2026-06-01T04:25:15+00:00

How do i do that? Actually my main goal is to get which checkbox

  • 0

How do i do that?
Actually my main goal is to get which checkbox in the QTreeWidget is checked. But this I can do if you guys help me out with that one.
Well, I cannot find a method that gives me the QList<QTreeWidgetItem *> again so I could go all over the list and check if the checkboxes are checked(weird sentence, huh?).
QTreeWidget::selectedItems() does not do what I want. It actually gets the selected item (which can be just one. So I don’t know what the itemS means here. I might be wrong anyway).

My main goal NOW is: go through the QTreeWidget being able to do whatever I want with the items of it.

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-06-01T04:25:16+00:00Added an answer on June 1, 2026 at 4:25 am

    Since you’re dealing with a tree, the API is designed to give you access to the QTreeWidgetItems in a tree-structure. Thus there is no direct way to simply get access to every single QTreeWidgetItem directly through Qt’s API. There are, however, two ways you can do this:

    1) If all of your items (or all the items you care about) are “top-level” then you can do something like this:

    for( int i = 0; i < tree->topLevelItemCount(); ++i )
    {
       QTreeWidgetItem *item = tree->topLevelItem( i );
    
       // Do something with item ...
    }
    

    2) If you need to access every item in the tree, along with that item’s children, then a recursive approach may be in order:

    doStuffWithEveryItemInMyTree( tree->invisibleRootItem() );
    
    void doStuffWithEveryItemInMyTree( QTreeWidgetItem *item )
    {
        // Do something with item ...
    
        for( int i = 0; i < item->childCount(); ++i )
            doStuffWithEveryItemInMyTree( item->child(i) );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know where I can get a free web crawler that actually works
So I know of a few people that actually write their algorithms out in
How do you update this? I've never seen any current team that actually checks
I'm trying to use PyLucene, and I can't find any code examples that actually
so it would appear that the only values that actually work are 0.0, 0.5,
I've inherited a Java web app that actually uses a Silverlight XAP for one
I created a program in C++2011 that actually uses features of C++2011: mutex ,
Here is my scenario: I have a proxy that actually has the SSL Cert
I know nothing about Xcode, except it's a Developer interface from Apple that actually
How can I override Hudson build number? It sounds like an easy question, but

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.