Results 1 to 10 of 10

Thread: Problem with painting QTable cell

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Problem with painting QTable cell

    Hello!

    I try to paint special cell (dynamicaly of course) and i get this error for each cell i execute paint on it:
    "QGVector::remove: Index -7 out of range"
    and the cell does not change color and it is whitout any data.

    Qt Code:
    1. void UAutomat::PopulateVrednosti(int nRow)
    2. {
    3. tblRezultat->setText(nRow,0,QString("%1").arg(_ucenje->GetPovKaz(),0,'f',4));
    4. for(int i=0;i<_ucenje->_igralec.GetMaxAkc();i++)
    5. {
    6. if (i== _ucenje->GetAkcija())
    7. {
    8. MyItem it(tblRezultat,QTableItem::Never,QString("%1 \%").arg(_ucenje->_igralec.GetVerN(i)*100,0,'f',2));
    9.  
    10. if (_ucenje->GetKazen()) it.SetBkgColor(Qt::red);
    11. else it.SetBkgColor(Qt::green);
    12.  
    13. QColorGroup cg = colorGroup();
    14. QPainter p(tblRezultat);
    15. it.paint(&p,cg,tblRezultat->cellGeometry(nRow,i),false);
    16. }
    17. else
    18. tblRezultat->setText(nRow,i+1,QString("%1 \%").arg(_ucenje->_igralec.GetVerN(i)*100,0,'f',2));
    19. }
    20.  
    21. tblRezultat->showRow(nRow);
    22. }
    To copy to clipboard, switch view to plain text mode 

    tblRezultat is a pointer to QTable

    MyItem code is here
    Last edited by high_flyer; 27th April 2007 at 13:24. Reason: missing [code] tags

Similar Threads

  1. Highlighting a cell in QTable
    By sumsin in forum Qt Programming
    Replies: 1
    Last Post: 18th April 2007, 06:28
  2. word wrapping in QTable Cell
    By joseph in forum General Discussion
    Replies: 0
    Last Post: 27th November 2006, 09:30
  3. QTable resize problem with large tables
    By Robzzz in forum Newbie
    Replies: 3
    Last Post: 22nd May 2006, 14:13
  4. QTable - Cell Thickness
    By Solarity in forum Newbie
    Replies: 4
    Last Post: 16th March 2006, 19:15
  5. Problem with QTable
    By zlatko in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 10:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.