UniDesk Control Library Overview
UniDesk is a built-in QML control library of Uniquenium, inspired by LingmoUI, providing a set of modern Fluent-style UI controls. Using UniDesk, you can quickly build beautifully designed, uniformly styled desktop application interfaces.
Read the Glossary First
Before starting, it is recommended to read the Glossary to understand the difference between Control and Component. This page introduces "controls" — the most basic elements that make up the interface.
System Requirements
Before developing with UniDesk, ensure your environment meets the following requirements:
| Dependency | Minimum Version | Description |
|---|---|---|
| CMake | 3.25+ | Build system |
| Qt | 6.5.0+ | QML engine and Qt Quick (including Core, Widgets, Quick, QuickControls2, etc.) |
| ECM | Latest | Extra CMake Modules |
| C++ Compiler | C++17 | MSVC 2022 / GCC 13+ / Clang 16+ |
Learning Suggestion
Before starting, it is recommended to read the Qt official QML documentation to understand basic QML syntax and concepts.
Development Environment Setup
Step 1: Get the Source Code
git clone https://github.com/Uniquenium/Uniquenium.git
cd Uniquenium
git submodule update --init --recursiveStep 2: Configure & Compile
# Configure (replace with your Qt6 path)
cmake -B build -DCMAKE_PREFIX_PATH="<Your Qt6 installation path>"
# Compile
cmake --build build --config ReleaseStep 3: Launch the Program
# Windows:
.\build\Release\Uniquenium0.exe --debug
# Linux:
./build/Uniquenium0 --debugControl Library: UniDesk
Module Import
Use the following statements at the beginning of QML files to import UniDesk controls:
// Base module (global singletons: UniDeskGlobals, UniDeskTools, UniDeskSettings...)
import UniDesk 1.0
// UI control module (all visual controls including buttons, text, windows)
import UniDesk.Controls 1.0Control Classification
Content in UniDesk is divided into two categories:
| Category | Description | Naming Pattern | Examples |
|---|---|---|---|
| Singleton | Globally unique instances, accessed directly by name for global state and tools | Any global state/tool | UniDeskGlobals, UniDeskTools, UniDeskSettings |
| Control | Instantiable, nestable visual UI elements, the foundation of building components | UniDesk + control name | UniDeskButton, UniDeskWindow, UniDeskText |
Base Classes Removed
Early versions had "base class" concepts like UniDeskBase and UniDeskWindowBase. The current version has removed the base class abstraction layer. All controls now directly inherit from Qt native types (such as Item, Rectangle, Window), without the need for indirect inheritance through base classes. If you see bases-related references in old documentation or code, use this page as the standard.
Using Singletons
Singletons are globally unique objects that do not need to be instantiated — they can be accessed directly by name in any QML file.
import UniDesk 1.0
import UniDesk.Controls 1.0
Item {
Component.onCompleted: {
// Access properties directly
console.log("Current theme:", UniDeskGlobals.isLight ? "Light" : "Dark")
console.log("Theme color:", UniDeskSettings.primaryColor)
// Call methods directly
UniDeskTools.web_browse("https://github.com/Uniquenium")
var uuid = UniDeskTools.createUuid()
}
}General format:
<singletonName>.<propertyName>
<singletonName>.<functionName>(parameters)Using Controls
Visual controls are used through QML declarative syntax, supporting properties, signals, and nested children. Controls can be used individually or combined to form more complex "components."
import UniDesk.Controls 1.0
// Parent control
UniDeskWindow {
id: myWindow
visible: true
width: 600
height: 400
title: "My Window"
// Properties
tintOpacity: 0.85
showStayTop: true
// Event (signal) handling
onActiveChanged: {
console.log("Window active status:", active)
}
// Child controls (nested)
UniDeskButton {
id: myBtn
anchors.centerIn: parent
contentText: "Click Me"
iconSource: "qrc:/icon/heart.svg"
display: Button.TextUnderIcon
radius: 8
onClicked: {
myWindow.showSuccess("Button clicked!", 3000)
}
// Nested grandchild control
UniDeskTooltip {
text: "This is a button tooltip"
}
}
}General pattern:
<controlName> {
<propertyName>: <propertyValue>
<signalName>: { /* handle logic */ }
<childControlName> { /* ... */ }
}Built-in Singletons Overview
| Singleton | Purpose | Common Content |
|---|---|---|
| UniDeskGlobals | Global state | isLight theme mode, event notifications |
| UniDeskTools | Tool functions | Color switching, wallpaper operations, font management, UUID generation |
| UniDeskSettings | Settings access | primaryColor theme color, various configuration read/write |
| UniDeskTextStyle | Preset fonts | tiny / little / middle / big four font sizes |
| UniDeskExpr | Expression engine | %variable substitution, %{} math expressions |
| UniDeskPluginMgr | Plugin management | Plugin loading, unloading, metadata management |
| UniDeskTempleteMgr | Template management | Template import/export, preset variables |
| UniDeskComponentsData | Component data | Component and page JSON data persistence |
| UniDeskComManager | Component management | Component registration, creation, destruction |
| UniDeskSettingsWindow | Settings window | Program settings UI entry |
Theme Adaptation Best Practices
All UniDesk controls have built-in dark/light dual themes, but custom controls require manual adaptation:
import UniDesk 1.0
Rectangle {
id: myCard
width: 200
height: 120
radius: 8
// Wrong: hardcoded color
// color: "white"
// border.color: "black"
// Correct: use UniDeskGlobals for dynamic judgment
color: UniDeskGlobals.isLight
? Qt.rgba(255/255, 255/255, 255/255, 1)
: Qt.rgba(32/255, 32/255, 32/255, 1)
border.color: UniDeskGlobals.isLight
? Qt.rgba(0, 0, 0, 0.1)
: Qt.rgba(1, 1, 1, 0.1)
// Accent color always uses theme color
Rectangle {
width: 4
height: parent.height
color: UniDeskSettings.primaryColor
}
}For more precise color control, use UniDeskTools.switchColor():
import UniDesk 1.0
property color textNormalColor: UniDeskGlobals.isLight ? "black" : "white"
property color textHoverColor: UniDeskGlobals.isLight ? textNormalColor.darker(1.2) : textNormalColor.lighter(1.2)
property color textPressColor: UniDeskGlobals.isLight ? textNormalColor.darker(1.5) : textNormalColor.lighter(1.5)
property color textDisableColor: "#888888"
property color finalColor: UniDeskTools.switchColor(
textNormalColor, textHoverColor, textPressColor, textDisableColor,
hovered, pressed, disabled
)Control Documentation Index
View detailed API documentation for each control by functional category:
Singletons
- UniDeskGlobals
- UniDeskTools
- UniDeskSettings
- UniDeskTextStyle
- UniDeskExpr
- UniDeskPluginMgr
- UniDeskTempleteMgr
- UniDeskComponentsData
- UniDeskComManager
- UniDeskSettingsWindow
Windows & Containers
- UniDeskWindow - Frameless acrylic window
- UniDeskDialog - Dialog
- UniDeskFrame - Group container / card
- UniDeskAcrylic - Acrylic blur effect
- UniDeskAppBar - Application top bar
- UniDeskShadow - Shadow effect
Button Controls
- UniDeskButton - Standard button (icon + text)
- UniDeskTextButton - Text-only button
- UniDeskIcon - Icon-only display
Input Controls
- UniDeskTextField - Single-line text input
- UniDeskTextArea - Multi-line text area
- UniDeskSpinBox - Numeric spin box
- UniDeskComboBox - Dropdown selection
- UniDeskFontBox - Font selector
- UniDeskPathSelector - File/directory path selector
- UniDeskColorPicker - Color picker
- UniDeskSlider - Slider
- UniDeskHotkeyPicker - Shortcut picker
Selection Controls
- UniDeskCheckBox - Checkbox
- UniDeskRadioButton - Radio button
Text & Display
- UniDeskText - Text label
- UniDeskImage - Image display
- UniDeskTooltip - Floating tooltip
- UniDeskInfoBar - Info bar
- UniDeskMessageBox - Message dialog
Navigation & Tabs
- UniDeskTabBar - Tab bar
- UniDeskTabButton - Tab button
Menu System
- UniDeskMenu - Pop-up menu
- UniDeskMenuItem - Menu item
- UniDeskMenuSeparator - Menu separator
Position & Size Selection
- UniDeskPosSelector - Position selector
- UniDeskSizeSelector - Size selector
Component Editor Specific
- UniDeskComBase - Component base (for Uniquenium visual editor)
- UniDeskComBox - Component container box
- UniDeskComBasicOptions - Component basic options panel
- UniDeskComRectEditor - Component rectangle editor
- UniDeskComManager - Component manager
Base Object
- UniDeskObject - Object base class
Next Steps
- Want to understand term distinctions? Read the Glossary
- Want to develop plugin extensions? Read the Plugin Development Guide
- Want to share page layouts? Read the Template System
- Encountered issues during use? Check the FAQ

