Classes | |
struct | markData |
struct | shadeData |
Public Member Functions | |
MarkedScrollBar (QWidget *parent=0) | |
void | addMark (int position, const QColor &colour, const QString &identifier="") |
void | removeMark (int position) |
void | removeMark (const QString &identifier) |
void | removeAllMarks () |
void | removeMarksLessThan (int position) |
void | removeMarksGreaterThan (int position) |
void | removeMarksBetween (int startPos, int endPos) |
void | addShade (int startPos, int endPos, const QColor &colour, const QString &identifier="") |
void | removeShade (const QString &identifier) |
void | removeAllShades () |
bool | isClipped () const |
void | enableClipping (bool clip) |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *event) |
Protected Attributes | |
QList< markData > | m_marks |
QList< shadeData > | m_shades |
bool | m_isClipped |
Properties | |
bool | clipped |
A MarkedScrollBar is a special type of scroll bar which supports marks. These are small lines that are rendered onto the track of the scroll bar that can be used to indicate the location of points of interest.
An example usage of scroll bar marks would be to highlight the location of compiler warnings/errors (with different colours for each) in a piece of source code.
Furthermore the class also provides support for shades. While marks indicate a specific point in a document/view shades indicate a range or block. An instance where a shade would be useful is in a collaborative text editor in order to show which parts of the document have been selected by different users.
Marks and shades are provided in scroll bar coordinates, between minimim() and maximum() with the translation to device coordinates being performed behind the scenes by the class.
Definition at line 27 of file markedscrollbar.h.
void MarkedScrollBar::addMark | ( | int | position, | |
const QColor & | colour, | |||
const QString & | identifier = "" | |||
) |
Adds a new mark to the scroll bar. If no identifier is specified then this defaults to a blank string.
position | The position in the scroll bar to add the mark to. | |
colour | The colour of the mark. | |
identifier | A string which can later be used to identify the mark. |
Definition at line 61 of file markedscrollbar.cpp.
void MarkedScrollBar::addShade | ( | int | startPos, | |
int | endPos, | |||
const QColor & | colour, | |||
const QString & | identifier = "" | |||
) |
Adds a new shade between startPos and endPos.
startPos | The starting position of the shaded block. | |
endPos | The ending position of the shaded block. | |
colour | The colour of the shade. | |
identifier | The identifier to use for the shade. |
Definition at line 180 of file markedscrollbar.cpp.
void MarkedScrollBar::enableClipping | ( | bool | clip | ) |
Sets if the slider should be used to clip the drawing of marks/shades.
clip | If to clip or not. |
Definition at line 231 of file markedscrollbar.cpp.
bool MarkedScrollBar::isClipped | ( | ) | const |
Returns if the slider is used to clip the drawing of marks/shades.
Definition at line 222 of file markedscrollbar.cpp.
void MarkedScrollBar::removeAllMarks | ( | ) |
Removes all marks from the scroll bar.
Definition at line 107 of file markedscrollbar.cpp.
void MarkedScrollBar::removeAllShades | ( | ) |
Removes all shades from the scroll bar.
Definition at line 213 of file markedscrollbar.cpp.
void MarkedScrollBar::removeMark | ( | const QString & | identifier | ) |
Removes the mark identified by identifier.
identifier | The identifier of the mark to be removed. |
Definition at line 91 of file markedscrollbar.cpp.
void MarkedScrollBar::removeMark | ( | int | position | ) |
Removes the mark at position.
position | The position of the mark to be removed. |
Definition at line 73 of file markedscrollbar.cpp.
void MarkedScrollBar::removeMarksBetween | ( | int | start, | |
int | end | |||
) |
Removes all marks with a position between start and end.
start | The starting position. | |
end | The ending position. |
Definition at line 154 of file markedscrollbar.cpp.
void MarkedScrollBar::removeMarksGreaterThan | ( | int | position | ) |
Removes all marks from the scroll bar which occur after position.
position | The position to remove all marks greater than. |
Definition at line 135 of file markedscrollbar.cpp.
void MarkedScrollBar::removeMarksLessThan | ( | int | position | ) |
Removes all marks from the scroll bar which occur before position.
position | The position to remove all marks less than. |
Definition at line 117 of file markedscrollbar.cpp.
void MarkedScrollBar::removeShade | ( | const QString & | identifier | ) |
Removes the shade with an identifier of identifier.
identifier | The identifier of the shade to remove. |
Definition at line 197 of file markedscrollbar.cpp.