Unintentional empty block | Qt Qml | Qt 6.11.1
Description: [unintentional-empty-block] An empty block was created, likely in place of an object literal.

- Qt 6.11
- Qt Qml
- QML Lint Warning and Errors
- Unintentional empty block
- Qt 6.11.1 Reference Documentation

# Unintentional empty block

This warning category is spelled `[unintentional-empty-block]` by qmllint.

## Unintentional empty block

### What happened?

An empty block was declared as the expression for a property binding.

You likely intended to declare an empty object literal instead. To do so, wrap the literal in parentheses. This is required to disambiguate the literal from an empty block.

### Why is that bad?

Assigning a block with no instructions as a property binding does nothing and might confuse the reader. When evaluating that binding, no instructions will be executed and the binding will evaluate to undefined.

### Example

     import QtQml

     QtObject {
         property var v: {} // This is not an empty object literal!
     }

To fix this warning, wrap the object literal in parentheses, or remove the binding altogether:

     import QtQml

     QtObject {
         property var v: ({}) // This is an empty object literal
     }