UDCText Component
Text display component — one of the most commonly used components in Uniquenium. Supports complete text property configuration (font, color, alignment, styles) and has a built-in %{} expression engine for dynamic data display (CPU usage, battery, time, etc.).
| Item | Description |
|---|---|
| Component Type | Built-in (UDC) |
| Source File | UniDesk/Components/UDCText/UDCText.qml |
| Inherits | UniDeskComBase → UniDeskComBox → UniDeskObject |
Properties
Content
property string textContent: Text content. Supports%{variable}expression syntax, automatically parsed byUniDeskExpr. Default:"Text"
Appearance
property color textColor: Text color. Follows theme by default: black for light, white for darkproperty color styleColor: Accent color. Defaults toUniDeskSettings.primaryColorproperty int textFormat: Text format (Text.PlainText/Text.RichText/Text.MarkdownText). Default:Text.RichTextproperty int wrapMode: Line wrap mode. Default:Text.Wrap
Font
property string fontFamily: Font family. Defaults toUniDeskTextStyle.familyproperty real fontSize: Font size in pixels. Default: 30property bool bold: Bold. Default:falseproperty bool italic: Italic. Default:falseproperty bool underline: Underline. Default:falseproperty bool strikeout: Strikeout. Default:falseproperty bool smallCaps: Small caps. Default:falseproperty int weight: Font weight. Default:Font.Normalproperty int style: Font style. Default:Text.Normal
Spacing & Alignment
property real letterSpacing: Letter spacing. Default: 0property real wordSpacing: Word spacing. Default: 0property real lineHeight: Line height multiplier. Default: 1property int horizontalAlignment: Horizontal alignment. Default:Text.AlignHCenterproperty int verticalAlignment: Vertical alignment. Default:Text.AlignVCenter
Dynamic Expressions
UDCText uses an internal flushText Timer (50ms interval) to continuously call UniDeskExpr.convertStr() and refresh the text. Supported %{} variables:
| Variable | Description |
|---|---|
%{cpu} | CPU usage |
%{mem} | Memory usage |
%{net} | Network download speed |
%{bat} | Battery percentage |
%{date} | Current date |
%{time} | Current time |
%{datetime} | Current date and time |
Custom variables can also be passed through template presets.
Example
qml
// Display real-time CPU and battery
// In the component editor, create UDCText, set textContent to:
"CPU: %{cpu}% Battery: %{bat}%"
// Welcome message
"Welcome to Uniquenium"
// Rich text
"<b>Bold</b> <font color='red'>Red text</font>"Property Data Export
javascript
function propertyDataEx() {
return {
textContent, textColorR, textColorG, textColorB, textColorA,
fontFamily, fontSize, smallCaps, bold, italic, underline, strikeout,
letterSpacing, wordSpacing, lineHeight, weight, style,
styleColorR, styleColorG, styleColorB, styleColorA,
textFormat, wrapMode, horizontalAlignment, verticalAlignment
}
}Related
- UniDeskExpr —
%{}expression engine - UniDeskTextStyle — Global font styles
- UniDeskSettings —
primaryColortheme color

