Skip to content

Shape Edit Panel

DAShapeEditPannelWidget combines a brush editor and a pen editor to provide complete shape style editing (background brush + border pen).

Preview

DAShapeEditPannelWidget: background brush + border pen

The background fill (brush) and border (pen) editors are stacked vertically. They emit backgroundBrushChanged and borderPenChanged independently, so a property panel can react to each separately.

Key Features

  • ✅ Background brush: Integrates DABrushEditWidget
  • ✅ Border pen: Integrates DAPenEditWidget
  • ✅ Independent signals: Brush and pen each have their own change signals

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include "DAShapeEditPannelWidget.h"

auto *shapePanel = new DA::DAShapeEditPannelWidget(parent);

// Set the background brush
QBrush brush(QColor("#4ECDC4"), Qt::SolidPattern);
shapePanel->setBackgroundBrush(brush);

// Set the border pen
QPen pen(Qt::darkCyan, 2, Qt::SolidLine);
shapePanel->setBorderPen(pen);

// Get current values
QBrush currentBrush = shapePanel->getBackgroundBrush();
QPen currentPen = shapePanel->getBorderPen();

Signal Handling

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Brush changed
QObject::connect(shapePanel, &DA::DAShapeEditPannelWidget::backgroundBrushChanged,
    [](const QBrush& brush) {
        qDebug() << "Background brush:" << brush.color().name();
    });

// Pen changed
QObject::connect(shapePanel, &DA::DAShapeEditPannelWidget::borderPenChanged,
    [](const QPen& pen) {
        qDebug() << "Border pen:" << pen.color().name() << pen.width();
    });

Class Relationships

classDiagram
    class DAShapeEditPannelWidget {
        +setBackgroundBrush(QBrush)
        +setBorderPen(QPen)
    }
    class DABrushEditWidget {
        +getCurrentBrush()
    }
    class DAPenEditWidget {
        +getCurrentPen()
    }

    DAShapeEditPannelWidget --> DABrushEditWidget : contains
    DAShapeEditPannelWidget --> DAPenEditWidget : contains

Composition Pattern

DAShapeEditPannelWidget is a thin composition wrapper — it does not duplicate brush/pen editing logic but simply hosts the two sub-widgets and forwards their signals. This keeps the API surface small while providing full editing capability.

Core Properties & Methods

Method Description
getBackgroundBrush() / setBackgroundBrush(QBrush) Get/set the background brush
getBorderPen() / setBorderPen(QPen) Get/set the border pen

References