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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:11:05+00:00 2026-06-02T00:11:05+00:00

I want to create a Photoshop like GUI for layer selection and visibility to

  • 0

I want to create a Photoshop like GUI for layer selection and visibility to manage the layers for my software. Basically, I want to have something like a ListView with the QListWidgetItem having text for the layer and a check-box for visibility.

At first it seemed easy to do with QListWidget and QListWidgetItem by setting the flags of the item to make it UserCheckable. It works to some extent, but it forces me to select a ‘layer’ before I can change its visibility.

Is there some way to implement QListWidgetItem so that I can check/uncheck the check-box without having to select the item? Or should I try something else to implement my layer manager?

I am considering to do it with QGraphicsView and QGraphicsItem, but I’d really like to know if I can implement this without.

  • 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-02T00:11:07+00:00Added an answer on June 2, 2026 at 12:11 am

    QListWidget uses itemAt( ) to determine a clicked items bounding rectangle and selects it – even when its only the checkbox. As this method is not virtual, you cannot change that behaviour without any dirty tricks (changing selection each time check boxes toggled etc). You would have to derive your own QListView and QAbstractItemModel (like QListWidget does). Dont worry, others noticed the some inconvinient check/selection behaviour. Let me give you some direction:

    You should derive your own QAbstractItemModel which has two columns. The first columns is your checkbox column and you need to assign a column delegate which draws checkbox items, the second is your display text column (not covered below). Then in YourListView class:

    Connect the clicked signal to your own slot:

     connect( this, SIGNAL(clicked( const QModelIndex &  )), this, SLOT(clickedSlot( const QModelIndex &  )) );
    

    and declare/use

     void YourListView::clickedSlot( const QModelIndex &index )
     {        
           if( index.isValid() )
           {
              // Checkbox toggle
    
              if( index.column() == 0 )
              {
                 QVariant beforeValue = this->model()->data( index );
    
                 this->model()->setData( index, QVariant::fromValue( ! beforeValue.toBool() ) );
              }
              else
              if( index.column() == 1 )
              {
                 this->selectionModel()->select( index, QItemSelectionModel::Toggle );
              }
           }
     }
    

    I know the Qt’s model-view-delegate architecture is somewhat scary for the untrained programmer, but once understood its fun. Ah, I would personally refrain from using a hand-woven QGraphicsView solution – it has its own traps and corners which likely will cost you more time to get it into acceptable shape.

    Good Luck!

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

Sidebar

Related Questions

I want create subdomains like this: domain.com/type/city An examples: domain.com/restaurants/new_york domain.com/hotels/new_york domain.com/restaurants/chicago I have
i want create image animation , i have 50 images with png format now
I want to create a Window like when a context menu pops up or
I'm looking for a software similar to Photoshop, but to create a CSS3 styled
I have created a simple web page in Photoshop and want to use it
If I have a bottom layer color and an alpha value (C&A) and want
I want create a excel with Apache POI in java and I must insert
I want create module which update list of usb devices automatically (not only mass
We want to create a widget platform for a particular website. I couldn't find
I want to create a file in the current directory (where the executable is

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.