Skip to content
Back to skills

Qt Signals Slots

ASecurity

Guide for implementing Qt signals and slots pattern in C++ applications.

  • 2 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 5, 2026
code-qualityc++testing

Security analysis

A100/100

Scanned June 5, 2026

npx -y skills add Burburton/amazingteam --skill qt-signals-slots --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Qt Signals Slots?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Qt Signals Slots
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/burburton-qt-signals-slots/badge)](https://www.skillsdirectory.com/skills/burburton-qt-signals-slots)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Qt Signals & Slots Skill

## Purpose

Guide for implementing Qt signals and slots pattern in C++ applications.

## Best Practices

### Signal Declaration

```cpp
signals:
    void dataChanged(const QString& id);
    void statusUpdated(Status newStatus);
```

### Slot Declaration

```cpp
public slots:
    void onDataChanged(const QString& id);
    void handleStatusUpdate(Status newStatus);
```

### Connection Patterns

```cpp
// Old syntax (Qt 4/5 compatible)
connect(sender, SIGNAL(dataChanged(QString)), 
        receiver, SLOT(onDataChanged(QString)));

// New syntax (Qt 5+, preferred)
connect(sender, &Sender::dataChanged, 
        receiver, &Receiver::onDataChanged);

// Lambda connection
connect(sender, &Sender::dataChanged, this, [this](const QString& id) {
    handleDataChange(id);
});
```

## Common Mistakes to Avoid

1. **Missing Q_OBJECT macro** - Always include in class declaration
2. **Signal-slot signature mismatch** - Parameters must match exactly
3. **Dangling connections** - Use Qt::UniqueConnection when appropriate
4. **Blocking slots** - Avoid heavy operations in slots

## Testing Signals

```cpp
QSignalSpy spy(&object, &MyClass::dataChanged);
emit object.doSomething();
QCOMPARE(spy.count(), 1);
```

## Thread Safety

- Use `Qt::QueuedConnection` for cross-thread communication
- Avoid direct signal emission from worker threads to UI

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.