Skip to content

UniDeskComRectEditor Type

Component rectangle editor control, providing drag-to-move, edge resize, corner resize, and rotate interactions for components in the visual editor.

ProjectDescription
Control TypeVisual Control
Source FileUniDesk/Controls/UniDeskComRectEditor.qml
InheritsQtQuick Item
QML Importimport UniDesk.Controls 1.0

Editor Only

This control is mainly used internally by the Uniquenium visual editor.

Custom Properties

PropertyTypeDescription
comManagervarComponent manager reference
editingComponentItemComponent currently being edited
visibleboolVisibility (bound to editingComponent.chosen)
isRotatingboolWhether currently rotating
isDraggingTopLeftCornerboolDrag top-left corner
isDraggingTopSideboolDrag top edge
isDraggingRightSideboolDrag right edge
isDraggingBottomSideboolDrag bottom edge
isDraggingLeftSideboolDrag left edge

Features

  • 9 control points: 4 corners + 4 edges + 1 rotation button
  • Each control point is circular, highlighted on hover
  • Real-time updates of x, y, width, height, rotation during drag
  • Auto-calls editingComponent.saveComToFile() after each operation
  • Rotation support via angle offset calculation (Math.atan2)
  • Rotation-aware scaling: correctly handles dimension changes in rotated coordinate systems

Methods

function hoverOnAnyButton(pos) → bool

Check if mouse position is over any control point.

function recordInitialState()

Record initial state (position, size, rotation) before dragging.

Example

qml
import UniDesk.Controls 1.0

UniDeskComRectEditor {
    comManager: comManager
    editingComponent: someComponent
}

Released under the CC BY-SA 4.0 open documentation license.