Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use the git plugin from Qt Creator in a custom plugin?
Forum Updated to NodeBB v4.3 + New Features

How to use the git plugin from Qt Creator in a custom plugin?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.3k 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.
  • VMironiukV Offline
    VMironiukV Offline
    VMironiuk
    wrote on last edited by
    #1

    Hi,

    I'm writing a custom Qt Creator plugin according to this guide.
    And now I want to use the git plugin from Qt Creator (specifically, GitClient class) in my plugin. For this purpose I did next steps:

    • I defined GIT_LIBRARY in "qt-creator-src/src/plugins/git/git.pro" file:
    DEFINES += GIT_LIBRARY
    
    • added git_global.h file to the git plugin with next content:
    #pragma once
    
    #include <qglobal.h>
    
    #if defined(GIT_LIBRARY)
    #  define GIT_EXPORT Q_DECL_EXPORT
    #else
    #  define GIT_EXPORT Q_DECL_IMPORT
    #endif
    
    
    • included git_global.h file in "qt-creator-src/src/plugins/git/gitclient.h" and used GIT_EXPORT in the GitClient class definition:
    #pragma once
    
    #include "git_global.h"
    
    // some code here
    
    class GIT_EXPORT GitClient : public VcsBase::VcsBaseClientImpl {
    
    // and some code here
    
    };
    
    • then I updated dependencies of my plugin:
    QTC_PLUGIN_NAME = MyPlugin
    QTC_LIB_DEPENDS += \
        # nothing here at this time
    
    QTC_PLUGIN_DEPENDS += \
        coreplugin \
        projectexplorer \
        vcsbase \
        git
    
    QTC_PLUGIN_RECOMMENDS += \
        # optional plugin dependencies. nothing here at this time
    
    

    And after all I try to create GitClient object:

    #include <git/gitclient.h>
    
    MyPlugin::MyPlugin()
    {
        Git::Internal::GitClient *git = new Git::Internal::GitClient;
    }
    
    

    but I got an error "undefined reference to `Git::Internal::GitClient::GitClient()'"

    I hope I just missed something, or is this mission impossible? :-)

    1 Reply Last reply
    0
    • hungerH Offline
      hungerH Offline
      hunger
      wrote on last edited by
      #2

      What do you want to do in your plugin?

      If you want to extend git support in creator, then I would be happy to take patches to the git plugin itself. No need to export the vitclient class that way:-)

      It you just need to use git, then can you try to extend the version control interfaces in core to support what you need? That way your plugin has a chance to work with all supported version control systems.

      I am very reluctant to export the GitClient class. That has a lot of methods that should not re exported and will need a big cleanup to be ready for wider exposure.

      VMironiukV 1 Reply Last reply
      1
      • hungerH hunger

        What do you want to do in your plugin?

        If you want to extend git support in creator, then I would be happy to take patches to the git plugin itself. No need to export the vitclient class that way:-)

        It you just need to use git, then can you try to extend the version control interfaces in core to support what you need? That way your plugin has a chance to work with all supported version control systems.

        I am very reluctant to export the GitClient class. That has a lot of methods that should not re exported and will need a big cleanup to be ready for wider exposure.

        VMironiukV Offline
        VMironiukV Offline
        VMironiuk
        wrote on last edited by
        #3

        @hunger Hi,
        actually, nothing special:-)
        I just play with creating of custom Qt Creator wizard where I could customize git repo with additional commands (adding remote, for example, or maybe something else) during creating a new project. And for this purpose I decided to use git client from Qt Creator because, as for me, it seems more naturally rather than other approaches (I wrote my own git client at first, just for testing, and it was buggy little bit:-))

        1 Reply Last reply
        0
        • VMironiukV Offline
          VMironiukV Offline
          VMironiuk
          wrote on last edited by VMironiuk
          #4

          Ah, yes I really missed one step:-)
          I forgotten to rebuild Qt Creator source and move new git plugin library (libGit.so) to the build directory of the Qt Creator instance which I use to test.
          Now everything works;-)

          1 Reply Last reply
          2

          • Login

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