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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:55:32+00:00 2026-05-26T05:55:32+00:00

Problem : When I select a row with a mouse on the table, pic

  • 0

Problem: When I select a row with a mouse on the table, pic #1 becomes pic #2 – as you can see, all my drawn icons are disappear!

Question: could anyone help me with this problem? Maybe some one already fall in with this dilemma and solve it? Thnks!

pic #1

enter image description here

pic #2

enter image description here

Additional: I’m using QTreeWidget as a table with some data (hidden root). To QTreeWidget object I append column delegates (for 1, 2 and 3 columns, but not for the 4! column). In all delegates (which are based on QStyledItemDelegate class) I have re implement paint() method, to draw my specific icons or text data.

Here is the code of one of the delegates (1 column) – it’s some kind of chain, some items grouped together (parent + childs):

void ChainTableDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
     QStyleOptionViewItem op = option;
     op.state &= ~QStyle::State_HasFocus;

     if( index.column() == TreeView::ePosChain )
     {
          QModelIndex parentIndex = index.parent();

          if( !childCount( index ) && !parentIndex.isValid() )
          {
               QStyledItemDelegate::paint( painter, op, index );
               return;
          }

          if( !parentIndex.isValid() )
          {
               // top
               painter->drawPixmap( pos( op, topActivePix_ ), topActivePix_ );
          }
          else
          {
               int row = index.row();
               if( row != childCount( parentIndex ) - 1 )
               {
                    // middle
                    painter->drawPixmap( pos( op, middleActivePix_ ), middleActivePix_ );
               }
               else
               {
                    // bottom
                    painter->drawPixmap( pos( op, bottomActivePix_ ), bottomActivePix_ );
               }
          }
     }

     QStyledItemDelegate::paint( painter, op, index );
}
  • 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-26T05:55:32+00:00Added an answer on May 26, 2026 at 5:55 am

    I think you should first call the parent method and then draw the pixmap 🙂

    Otherwise, you’ll just overwrite the icon you’ve just drawn with the highlight effect

    Cheers

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

Sidebar

Related Questions

Problem Given the following two tables, I'd like to select all Ids for Posts
I have a item list table. When I select a row of my table,
I'm having a table row selection problem with JXTable. If I run the following
I have an ASP.net gridview on a webform where user's can select a row.
I am using following query which works fine for me except one problem SELECT
I am new to struts 2. I am facing problem in filling Select tag
I am having the problem that I cannot select a specific XML node which
I have a problem with the query below in postgres SELECT u.username,l.description,l.ip,SUBSTRING(l.createdate,0,11) as createdate,l.action
Problem is located on http://www.preownedweddingdresses.com/ We have a dresses slider at the bottom, select
Strange problem. My Query looks like SELECT DISTINCT ID, `etcetc`, `if/elses over muliple joined

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.