Displays coloured highlights in the display text based on known differences between it and another string (ie that displayed in the cell next to it). Does not affect editing.
More...
#include <Tools/Widgets/differencehighlightingstyleditemdelegate.h>
|
| DifferenceHighlightingStyledItemDelegate (const QBrush &highlightBrush, const QColor &constrastColour, int stringHighlightRole, QObject *parent=nullptr) |
| An styled item delegate that colours the display cell of an item to highlight differences between the text displayed and an alternative cell.
|
|
| DifferenceHighlightingStyledItemDelegate (int stringHighlightRole, QObject *parent=nullptr) |
| An styled item delegate that colours the display cell of an item dark or light grey to highlight differences between the text displayed and an alternative cell.
|
|
void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE |
|
void | setColours (const QBrush &highlightBrush, const QColor &constrastColour) |
|
|
void | drawVerticalLines (QPainter &painter, const int top, const int left, const int width, const QColor &color, const QVector< int > &columns) const |
|
The required highlights must have already been calculated and stored in the model data for the item as role stringHighlightRole
- See also
- TextDifferencer::compareLines
◆ DifferenceHighlightingStyledItemDelegate() [1/2]
The differences should have already been calculated
- See also
- TextDifferencer::CompareLines and stored in the item model as role stringHighlightRole
- Parameters
-
highlightBrush | brush to be used to highlight the backround of text in this cell but not the alternate |
contrastColour | colour to be used for vertical lines showing where text exists in the alternate cell but not this |
stringHighlightRole | Qt::UserRole where the differences should be found |
parent | parent widget |
◆ DifferenceHighlightingStyledItemDelegate() [2/2]
Use this if you need to set up your column delegate before you have colours available
- See also
- TextDifferencer::CompareLines
-
setColours
◆ drawVerticalLines()
void drawVerticalLines |
( |
QPainter & |
painter, |
|
|
const int |
top, |
|
|
const int |
left, |
|
|
const int |
width, |
|
|
const QColor & |
color, |
|
|
const QVector< int > & |
columns |
|
) |
| const |
|
protected |
◆ paint()
void paint |
( |
QPainter * |
painter, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
◆ setColours()
void setColours |
( |
const QBrush & |
highlightBrush, |
|
|
const QColor & |
constrastColour |
|
) |
| |