Commit Graph

16 Commits

Author SHA1 Message Date
jessequ e63fae92c8 feat: add QPointF tree-expandable type editor to PropertyEditor 2026-07-31 15:26:08 +08:00
jessequ 94c48e7de8 feat: add QPointF tree-expandable type editor to PropertyEditor
Add PropertyTypeCustomization_PointF that renders QPointF as an
  expandable tree row: collapsed header shows formatted "(x, y)" text,
  expanded children provide NumberBox editing for x and y coordinates.
  Registered in mMetaTypeCustomizationMap alongside the existing QFont
  customization, reusing the RawType branch of getCustomPropertyType().
2026-07-31 15:13:47 +08:00
jessequ fda709c0e2 feat: add ptposition property to tect item 2026-07-31 14:29:17 +08:00
jessequ 2e93156093 feat: add QFont type editor with FontBox and fix property name top-alignment
Add FontBox QML editor for QFont properties — collapsed display shows
  "family, size pt", expanded inline dropdown provides family ComboBox
  (populated from QFontDatabase), compact +/- size buttons, and
  Bold/Italic/Underline toggles.

  QFont is a Q_GADGET type classified as Object by parserType(), so it
  requires both a PropertyTypeCustomization_Font (overrides
  customizeHeaderRow to create the value editor, customizeChildren as
  no-op) and a mMetaTypeCustomizationMap entry — the Object branch of
  getCustomPropertyType() is extended to check this map first.

  Also fix property name column to always top-align (anchors.top +
  implicitHeight) so it stays fixed when inline editors like FontBox
  expand vertically, rather than drifting to row center.

  Files (8 changed):
  - resources/Qml/ValueEditor/FontBox.qml           (new)
  - source/src/Customization/PropertyTypeCustomization_Font.h  (new)
  - source/src/Customization/PropertyTypeCustomization_Font.cpp (new)
  - resources.qrc
  - source/src/QQuickDetailsViewBasicTypeEditor.cpp
  - source/src/QQuickDetailsViewMananger.cpp
  - source/src/QQuickDetailsViewLayoutBuilder.cpp
  - source/src/PropertyHandleImpl/IPropertyHandleImpl.cpp
2026-07-27 21:54:57 +08:00
jessequ 8ea5033f0d feat: add text item with IShape interface decoupling
Extract a pure virtual IShape interface from AbstractShapeType<T> so
  selectors and Document use dynamic_cast<IShape *> instead of
  qgraphicsitem_cast<AbstractShape *>. This decouples the selector
  system from the template hierarchy, enabling GraphicsTextItem (backed
  by QGraphicsTextItem) to work uniformly with all existing selectors.

  GraphicsTextItem supports inline text editing (double-click to edit,
  focus-out to finish), font/color properties via PropertyEditor, resize
  with proportional font scaling, move, rotate, and full serialization.
  Adds CM_place creation mode for single-click placement.
2026-07-22 09:56:28 +08:00
JesseQu cd343895f9 fix: ads linux compile warning. 2026-07-15 18:10:35 +08:00
Jesse Qu a9dc41cf80 fix: add missing override keywords and virtual destructor to resolve all compiler warnings
- Mark 27 overriding functions with 'override' across GraphicsItemGroup,
    GraphicsRectItem, and GraphicPolygonItem headers
  - Add virtual destructor to IPropertyHandleImpl (fixes -Wdelete-abstract-non-virtual-dtor)
  - Build is now 0 warnings, 0 errors
2026-07-15 11:27:08 +08:00
Jesse Qu 3ad8b211e6 refactor: distribute serialization/deserialization from Document into item classes
Move per-type serialization logic out of Document's monolithic
  serializeItem()/deserializeItem() into each item class:

  - Add virtual serialize() to AbstractShapeType template, overridden by
    GraphicsRectItem, GraphicPolygonItem, and GraphicsItemGroup
  - Add static createFromJson() factory + self-registration to each item
  - Extract shared pen/brush/common helpers into serializationUtils
  - Add type registry (serializationRegistry) for factory-based deserialization
  - Document::saveAs()/load() now delegate to item->serialize() and
    createItemFromJson() — no longer owns per-type dispatch
  - Adding a new shape type no longer requires touching Document
2026-07-09 11:40:14 +08:00
Jesse Qu c8f71cb9e3 ⏺ feat: add Document layer with serialization, dirty tracking, and file actions
Introduce a Document QObject that composes DesignerScene + QUndoStack,
  following "composition over inheritance" and unidirectional signal-slot
  communication per Qt Graphics View Framework conventions.

  New files:
  - include/document.h — Document class declaration
  - source/document.cpp — full implementation (~450 lines)

  Core capabilities:
  - JSON serialization/deserialization for rect, roundRect, polygon, group
    (uses dynamic_cast dispatch since subclasses don't override type())
  - Two-path dirty tracking:
    1. QUndoStack::indexChanged for undoable ops (add/delete/group/ungroup)
    2. Explicit markDirty() via DesignerScene::notifyDocumentModified()
       called by selectors after successful move/scale/rotate/edit
  - save()/saveAs()/load()/clear() with maybeSave() prompt on close
  - File actions (New/Open/Save/Save As) wired to toolbar and File menu;
    window title tracks filename + modified indicator

  Integration changes:
  - DrawingPanel now receives scene via setScene() instead of creating it
  - CMainWindow routes all modifications through Document::execute()
  - DesignerScene gains notifyDocumentModified() for selector dirty marking
  - GraphicsRectItem gains isRound()/ratioX()/ratioY() accessors
  - CreatingSelector: fix missing signalAddItem emit for polygon completion
  - Scene lifecycle uses clear() instead of delete+recreate to avoid
    dangling view pointer

  Moved QUndoStack ownership from CMainWindow into Document.
2026-07-08 16:57:46 +08:00
Jesse Qu cd77e8cb58 Fix resource include path in drawingPanel.ui 2026-07-08 14:42:46 +08:00
Jesse Qu f9db2eb876 Refactor selector classes 2026-07-06 18:17:10 +08:00
Jesse Qu 5d2caba154 Add property-editor function. 2026-07-03 15:58:09 +08:00
Jesse Qu 23a9e48b75 Adjust graphics items 2026-07-03 14:26:43 +08:00
Jesse Qu 64c1189ba2 change CI machine 2026-07-03 11:54:57 +08:00
Jesse Qu e6be1a0a94 compile the project with QT 6.9.3 2026-07-03 11:41:24 +08:00
Jesse Qu 04db02dbdf first commit for HMI 2026-07-03 11:29:21 +08:00