class KTextEditor.Attribute |
|
|
A class which provides customized text decorations. The Attribute class extends QTextCharFormat, the class which Qt uses internally to provide formatting information to characters in a text document. In addition to its inherited properties, it provides support for: Implementations are not required to support all properties. In particular, several properties are not supported for dynamic highlighting (notably: font() and fontBold()). Unfortunately, as QTextFormat's setProperty() is not virtual, changes that are made to this attribute cannot automatically be redrawn. Once you have finished changing properties, you should call changed() to force redrawing of affected ranges of text. To do: consider if tracking which ranges use this attribute is needed See also SmartInterface
Author Hamish Rodda \ |
|
|
Default constructor. The resulting Attribute has no properties set to begin with. |
|
Copy constructor. |
|
Action association The following functions allow for KAction%s to be associated with attributes, and thus with ranges which use this attribute. \{ Associate an action with this attribute. When assigned to a range, this attribute will enable the associated action(s) when the caret enters the range, and disable them on exit. The action is also added to the context menu when the caret is within an associated range.
action - KAction to associate with this Attribute |
|
Returns a list of currently associated KAction%s. |
|
Determine whether background color is drawn over whitespace. Defaults to true if not set. Returns whether the background color should be drawn over whitespace |
|
Notify the editor implementation that a property of this attribute has been changed. This is used to re-render any text which has this attribute assigned to it. |
|
Clear all set properties. |
|
Clears all associations between KAction%s and this attribute. |
|
Remove the association with an action from this attribute; it will no longer be managed by associated ranges.
action - KAction to dissociate from this Attribute |
|
Dynamic highlighting The following functions allow for text to be highlighted dynamically based on several events. \{ Return the attribute to use when the event referred to by type occurs.
type - the activation type for which to return the Attribute. \returns the attribute to be used for events specified by type, or null if none is set. |
|
|
Custom properties The following functions provide custom properties which can be set for rendering by editor implementations. \{ fontWeight() Find out if the font weight is set to QFont.Bold. Returns true if the font weight is exactly QFont.Bold, otherwise false |
|
Determine if any properties are set. Returns true if any properties are set, otherwise false |
|
Get the brush used to draw an outline around text, if any. Returns brush to be used to draw an outline, or Qt.NoBrush if no outline is set. |
|
Get the brush used to draw the background of selected text, if any. Returns brush to be used to draw the background of selected text, or Qt.NoBrush if not set |
|
Get the brush used to draw text when it is selected, if any. Returns brush to be used to draw selected text, or Qt.NoBrush if not set |
|
Set whether background color is drawn over whitespace. Defaults to true if not set. Use clearProperty(BackgroundFillWhitespace) to clear.
fillWhitespace - whether the background should be drawn over whitespace. |
|
Set the attribute to use when the event referred to by type occurs. Nested dynamic attributes are ignored.
type - the activation type to set the attribute for attribute - the attribute to assign. As attribute is refcounted, ownership is not an issue. |
|
|
setFontWeight() Set the font weight to QFont.Bold. If bold is false, the weight will be set to 0 (normal).
bold - whether the font weight should be bold or not. |
|
Set a brush to be used to draw an outline around text. Use clearProperty(Outline) to clear.
brush - brush to be used to draw an outline. |
|
Set a brush to be used to draw the background of selected text, if any. Use clearProperty(SelectedBackground) to clear.
brush - brush to be used to draw the background of selected text |
|
Set a brush to be used to draw selected text. Use clearProperty(SelectedForeground) to clear.
foreground - brush to be used to draw selected text. |
ActivateMouseIn | - | Activate attribute on mouse in | |
ActivateCaretIn | - | Activate attribute on caret in |
Outline | - | Draws an outline around the text | |
SelectedForeground | - | Changes the brush used to paint the text when it is selected | |
SelectedBackground | - | Changes the brush used to paint the background when it is selected | |
BackgroundFillWhitespace | - | Determines whether background color is drawn over whitespace . Defaults to true . | |
AttributeDynamicEffect | - | Defined to allow storage of dynamic effect information | |
AttributeInternalProperty | - | Defined for internal usage of KTextEditor implementations | |
AttributeUserProperty | - | Defined to allow 3 rd party code to create their own custom attributes - you may use values at or above this property . |
EffectNone | - | EffectNone = 0x0 < No effect. Just display. , EffectFadeIn = 0x1 < Fade in and stay there. , EffectFadeOut = 0x2 < Fade out to vanish. , EffectPulse = 0x4 < Pulse (throb); change weight. , EffectCycleGradient = 0x8 < Cycle colors. |
EffectNone | - | EffectNone = 0x0 < No effect. Just display. , EffectFadeIn = 0x1 < Fade in and stay there. , EffectFadeOut = 0x2 < Fade out to vanish. , EffectPulse = 0x4 < Pulse (throb); change weight. , EffectCycleGradient = 0x8 < Cycle colors. |