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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:12:44+00:00 2026-05-27T00:12:44+00:00

Here is the main problem : I’m using QTreeWidget class as a main tree,

  • 0

Here is the main problem: I’m using QTreeWidget class as a main tree, which must show me this tree structure:

[Today]
   [Row1]
   [Row2]
      [SubRow21]
      [SubRow22]
   [Row3]
[Yesterday]
   [Row4]
      [SubRow41]
[etc]

With Qt Designer I have set this style sheet code:

QTreeWidget#treeWidget::item
{
    height: 24px;    
    border: none;    
    background-position: bottom left;   
    background-image: url(:/backgrounds/images/backgrounds/row_back.png);
}
QTreeWidget#treeWidget::item:selected
{
    color: #000000;    
    background-position: bottom left;
    background-image: url(:/spreadsheet/images/spreadsheet/row_back_selected.png);
}

And all items drawn with the *row_back.png* background image, but I need to draw another background image to [Today] and [Yesterday] rows! For these purposes I had inherit QStyledItemDelegate class, but don’t know methods, to reset style to new background image:

void MyColumnDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
     QStyleOptionViewItemV4 op = option;

     if( isPeriod( index ) )
     {
          // here I heed to change background image!!!

          //QStyle* style = op.widget ? op.widget->style() : QApplication::style();
          //style->drawControl( QStyle::CE_ItemViewItem, &op, painter, op.widget );

          //QRect backgroundRect( option.rect.x() + 5, option.rect.y() + 5, 18, 18 );
          //style->drawItemPixmap( painter, backgroundRect, Qt::AlignCenter, QPixmap( SOME_PIC ) );    
          //QStyledItemDelegate::paint( painter, op, index );

          return;
     }

     op.text = "";
     QStyle* style = op.widget ? op.widget->style() : QApplication::style();
     style->drawControl( QStyle::CE_ItemViewItem, &op, painter, op.widget );  

     QModelIndex dataIndex = index.model()->index( index.row(), ePosChain, index.parent() );
     LetterInfo data = index.model()->data( dataIndex, PackageDataRole ).value< LetterInfo >();

     switch( data.document_.state_ )
     {
     case( eStateSignedByOwner ):
          painter->drawPixmap( getPos( op, index, QPixmap( IMAGE2 ) ), QPixmap( IMAGE2 ) );
          break;
     case( eStateSignedByHost ):
          painter->drawPixmap( getPos( op, index, QPixmap( IMAGE1 ) ), QPixmap( IMAGE1 ) );
          break;
     }

     painter->drawText( getTextPos( op, index ), data.text );
}

Any help?

Thanks!

  • 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-27T00:12:44+00:00Added an answer on May 27, 2026 at 12:12 am

    Solved with this code:

    if( isPeriod( index ) )
         {
              QPixmap pixmap( PERIOD_ROW_BACKGROUND );
              painter->drawPixmap( op.rect, pixmap, pixmap.rect() );
    
              return;
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What am I doing wrong here: class Helo { // main: generate some simple
Here is a sample code: public class TestIO{ public static void main(String[] str){ TestIO
Here is the main problem. I have very large database (25,000 or so) of
My main problem is trying to find a suitable solution to automatically turning this,
The main problem here is to evaluate the user function at some point because
I found several examples how to use Ext.ux.grid.GridSummary() in GridPanel, main problem here is
The main problem here is with search url: http://code.google.com/intl/it/query/#p=appengine&q=query It doesn't contain ? symbol,
Here is my main page code: <form><iframe name=iframe_pic src=iframe.html></iframe></form> Here is my iframe.html: <script
here's the main code at first I thought is was the message box but
I'm looking for a way to monitor system statistics. Here are my main points

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.