[Guide] Code completion on Qt Creator for Ubuntu.Components



  • Hi,
    Just to share my experience for developping Apps with QtCreator:
    ( A rewrite from https://gist.github.com/lduboeuf/dcf22607207d5b7abc8ac966d20942ce )

    To get Ubuntu.Components recognized by QtCreator:

    • If you work on Ubuntu (16.04-18.04) :
    ## Get public Ubports key
    wget -qO - https://repo.ubports.com/pubkey.gpg | sudo apt-key add -
    
    ##add ubports repository
    sudo add-apt-repository "deb https://repo.ubports.com/ [bionic|xenial] main"
    
    ##install Ubuntu.components
    sudo apt install qml-module-ubuntu-components
    
    ##qml components should be installed in "/usr/lib/x86_64-linux-gnu/qt5/qml"
    ##set the environnement variable to profile
    echo "export QML_IMPORT_PATH=/usr/lib/x86_64-linux-gnu/qt5/qml" >> ~/.profile
    
    ##reload env or you might need to logout/login
    source ~/.profile
    
    • A more generic solution using clickable image:
    ##run container clickable
    docker run -i -t --entrypoint /bin/bash clickable/ubuntu-sdk:16.04-amd64
    
    ##in an another terminal, get the container id
    docker ps
    
    ##copy ubuntu components to local folder
    docker cp [container id]:/usr/lib/x86_64-linux-gnu/qt5/qml/ /your/local/directory
    
    ##set the environnement variable to profile
    echo "export QML_IMPORT_PATH=/your/local/directory" >> ~/.profile
    
    ##reload env or you might need to logout/login
    source ~/.profile
    
    ##stop container
    docker stop [container id]
    
    
    • Or running QtCreator in a docker container based from clickable image:

    example here: https://github.com/lduboeuf/ut-qtcreator , use branch "add module" branch for installing also qml modules



  • @lduboeuf Thanks a lot, I was thinking about trying to configure my computer to dev with QtCreator and you just saved me some trouble and probably a lot of time.

    Thank you very much.



  • if you use ##add ubports repository
    you should add gpg key as well:

    wget -qO - https://repo.ubports.com/pubkey.gpg | sudo apt-key add -
    


  • Capture d’écran de 2020-01-10 12-12-29.png

    Oh, now it should be easier to dig into components 🙂 . ( here using qtcreator in docker container with installed qml components https://github.com/lduboeuf/ut-qtcreator/tree/add_modules )

    https://youtu.be/LEpMFWy9FVM



  • Hi guys!

    Is it possible to get Ubuntu.Components recognized by QtCreator on Windows?



  • @Isaac said in [Guide] Code completion on Qt Creator for Ubuntu.Components:

    Is it possible to get Ubuntu.Components recognized by QtCreator on Windows?

    The copy components from docker solution should work ?


Log in to reply