QStyleditemdelegate painting over the edge



  • Hello,

    I've implemented my custom delegate to draw vertical bars into a QTableView cell. Problem is that the option.rect can overlap to the next cell and is paint over if the next row is painted.

    Any suggestion to resolve such behavior?

    !http://andreas-franke.org/home/home@andreas-franke.org/public/paint.jpg(delegatePaint)!


  • Moderators

    -set the clipping rect of the painter to option.rect-

    oh did get you wrong (the images wasn't displayed first time). You do want to overpaint. Then QTableView isn't the right way to go... you already found the reason why. ;)
    An item-cell should only paint inside it's designated area.

    Nevertheless if you insist in using QTableView you need to draw the overlapping part in the other cell...



  • [quote author="raven-worx" date="1375883471"]-set the clipping rect of the painter to option.rect-

    oh did get you wrong (the images wasn't displayed first time). You do want to overpaint. Then QTableView isn't the right way to go... you already found the reason why. ;)
    An item-cell should only paint inside it's designated area.[/quote]

    Ok, but what is the right way get a table with desired appearance?


  • Moderators

    i've edited my post:
    [quote author="raven-worx" date="1375883471"]
    Nevertheless if you insist in using QTableView you need to draw the overlapping part in the other cell...[/quote]



  • Ok, thank you for your hint.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.