On this page

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
}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.