-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Via edbee::LineData (LineAppendTextLayoutFormatListField). see: `edbee-lib/doc/line_data.md` for sample
- Loading branch information
1 parent
09bfbc0
commit ca05904
Showing
7 changed files
with
119 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
edbee documentation {#mainpage} | ||
=================== | ||
# edbee documentation {#mainpage} | ||
|
||
This is the generated documentation for the edbee library. | ||
Please use the menu above to navigate... | ||
|
||
[Coding Style](@ref coding-style) | ||
[Coding Style](coding-style.md) | ||
|
||
### Features | ||
|
||
[Line Data](line_data.md) | ||
|
||
... a big todo to show explain samples/features ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Line data | ||
|
||
Linedata support add the support for adding custom data to TextDocument lines. | ||
These data items are automaticly moved/delete when inserting/deleting lines. | ||
|
||
The line data is a fixed with array with pointers and is reserved for every line. | ||
The enum `TextLineDataPredefinedFields` defines the predefined fields that are built in edbee. | ||
The `PredefinedFieldCount' value can be used to find out where to start defining your custom types. | ||
|
||
To use extra custom fields you are required to set the number of fields to reserve. | ||
This can be done with `editor->textDocument()->lineDataManager()->setFieldsPerLine(3)` | ||
which needs to have at least the length of PredefinedFieldCount. | ||
|
||
|
||
## General usage | ||
|
||
To set a file for a given line you can invoke the giveLineData method. | ||
|
||
```cpp | ||
textDocument()->giveLineData(line, edbee::LineAppendTextLayoutFormatListField, data); | ||
``` | ||
Removing can be done by supplying a nullptr to the data | ||
```cpp | ||
textDocument()->giveLineData(line, edbee::LineAppendTextLayoutFormatListField, nullptr); | ||
``` | ||
|
||
## Predefined variable `LineAppendTextLayoutFormatListField` | ||
|
||
The predefined `LineAppendTextLayoutFormatListField` field type can be used to | ||
add custom `<QTextLayout::Format>` ranges to the QTextLayout of a line. | ||
|
||
For example, to add a waved red underline: | ||
|
||
```cpp | ||
// Set the line data for a given line (assuming this line is in the document!!) | ||
int line = 2; | ||
|
||
// build a list of QTextLayout::FormatRanges | ||
QList<QTextLayout::FormatRange> formatRanges; | ||
|
||
QTextLayout::FormatRange formatRange; | ||
formatRange.start = 0; | ||
formatRange.length = editor->textDocument()->lineLength(line); | ||
formatRange.format.setUnderlineStyle(QTextCharFormat::WaveUnderline); | ||
formatRange.format.setUnderlineColor(Qt::red); | ||
formatRanges.append(formatRange); | ||
|
||
// build a line data item (which is added to the TextLineData) | ||
edbee::LineAppendTextLayoutFormatListData *formatRangesListData = new edbee::LineAppendTextLayoutFormatListData(formatRanges); | ||
editor->textDocument()->giveLineData(line, edbee::LineAppendTextLayoutFormatListField, formatRangesListData); | ||
``` | ||
Because every line has it's own QTextLayout the range offset of the given line is 0. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#pragma once | ||
|
||
#define EDBEE_VERSION "0.9.0" | ||
#define EDBEE_VERSION "0.10.0" | ||
|
||
#define EDBEE_VERSION_MAJOR 0 | ||
#define EDBEE_VERSION_MINOR 9 | ||
#define EDBEE_VERSION_MINOR 10 | ||
#define EDBEE_VERSION_PATCH 0 | ||
#define EDBEE_VERSION_POSTFIX "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters