- Qt 6.12
- Qt Qml
- QML Lint Warning and Errors
- Unintentional empty block
- Qt 6.12.0 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
     }