Maybe not relevant anymore)
I will write this for those who also stumbled upon this post.
I solved it in the following way.
Postgresql database
Version Qt6.4.1

Qt Code:
  1. QSqlQuery *query = new QSqlQuery(db);
  2. query->exec("call test_procedure(1, 'p_rc'); FETCH ALL p_rc;");
  3. if(query->lastError().isValid())
  4. {
  5. qDebug()<<query->lastError();
  6. }
  7. while (query->nextResult())
  8. {
  9. while (query->next()) {
  10.  
  11. qDebug()<<query->value(1);
  12. }
  13. }
To copy to clipboard, switch view to plain text mode 

i am doing two consecutive requests
1. procedure call
2. reading the cursor.
and sequentially read the results of queries
Qt Code:
  1. while (query->nextResult())
To copy to clipboard, switch view to plain text mode