diff --git a/scripts/qt/qt_update_submodules.pl b/scripts/qt/qt_update_submodules.pl
index c72f4e1371147d34a9a2db9b8708d35681bcaa12..6e9ed4cc3b55223845cd2d8def8bfcd8118eac76 100755
--- a/scripts/qt/qt_update_submodules.pl
+++ b/scripts/qt/qt_update_submodules.pl
@@ -266,6 +266,12 @@ sub update_submodule
         confess "Command `@cmd' did not output a giturl";
     }
 
+    # Let's be prepared for relative paths in .gitmodules
+    if ($giturl eq "../$submodule.git") {
+        $giturl = trim $self->exe( qw(git config --file), ".git/config", "remote.origin.url" );
+        $giturl =~ s,[^/]+$,$submodule.git,;
+    }
+
     chdir catfile($base_dir, $submodule);
     $self->exe( qw(git fetch --verbose), $giturl, "+$ref:refs/heads/updated_submodule" );