Checking if looped item has a parent inside a shortcode

The WP_Post class has an attribute post_parent that you can use for this.

while ($q->have_posts()) {
      $q->the_post();
      $post = get_post();
      if (!empty($post->post_parent)) {
          // do something different
      }
}

techhipbettruvabetnorabahisbahis forumuedueduedusedueduedusedusedueduedus