Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator 4 custom plugin get current branch for project under version control
Forum Updated to NodeBB v4.3 + New Features

Qt Creator 4 custom plugin get current branch for project under version control

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
2 Posts 1 Posters 686 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • LeviL Offline
    LeviL Offline
    Levi
    wrote on last edited by
    #1

    I have noticed when creating a qmake project, that if it is under version control the branch name shows up in the project node display text. I have searched for hours and I have been unsuccessful at locating where this happens within the source code. The reason I ask, is I have a custom project manager plugin that will contain multiple repositories and I would like to display the current branch in the folder node display text.

    1 Reply Last reply
    0
    • LeviL Offline
      LeviL Offline
      Levi
      wrote on last edited by
      #2

      I figured out how to get the branch information. The code is below that I used to get the branch information given an absolute path.

      Headers:

      #include <coreplugin/vcsmanager.h>
      #include <coreplugin/iversioncontrol.h>
      

      Code:

      bool ROSProjectNode::hasVersionControl(const QString &absolutePath, QString &vcsTopic) const
      {
        if (Core::IVersionControl *vc = Core::VcsManager::findVersionControlForDirectory(absolutePath))
        {
          if (absolutePath == Core::VcsManager::findTopLevelForDirectory(absolutePath))
          {
            vcsTopic = vc->vcsTopic(absolutePath);
            return true;
          }
        }
        return false;
      }
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved