QVariant var; if (var.isNull()) { // code to handle null value }
int arr[5] = {1, 2, 3, 4, 5}; QVariant var = QVariant::fromValue(arr); if (var.isNull()) { // code to handle null value }In this example, we are creating a QVariant object from an integer array using the fromValue function and then checking if it is null using isNull. Package library: Qt.