Archive:Build your first KDE application on Kubuntu: Difference between revisions

From KDE UserBase Wiki
(Marked this version for translation)
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Construction}}
<languages />
<translate>
===Building your first KDE application using Kubuntu Linux 20.04=== <!--T:1-->


== Building your first KDE application using Kubuntu Linux 20.04 ==
===== Overview ===== <!--T:2-->


===== Overview =====
<!--T:3-->
This document aims to provide an overview on the pre-requisites required to create, compile and execute a simple KDE Application (windowed GUI application) using Kubuntu 20.04.
This document aims to provide an overview of the pre-requisites required to create, compile, and execute a simple KDE Application (windowed GUI application) using Kubuntu 20.04.


As most Linux distributions, including Kubuntu, do not install the necessary development packages - additional steps are required to get 'up and running' and be able to create a KDE Qt application.
<!--T:4-->
As most Linux distributions do not provide development packages by default, additional steps are required to get 'up and running' and be able to create a KDE Qt application, quickly.


===== Pre-requisites =====
===== Pre-requisites ===== <!--T:5-->
It is assumed that a 'Minimal' installation is performed of Kubuntu, which is running. Refer to this guide on how to setup a Virtual Machine for development: https://community.kde.org/Get_Involved/development/Developing_in_a_virtual_machine


===== Instructions =====
<!--T:6-->
It is assumed that a 'Minimal' installation of Kubuntu is performed. Refer to this guide on how to set up a Virtual Machine for development: https://community.kde.org/Get_Involved/development/Developing_in_a_virtual_machine


1. Follow the steps as outlined here at https://techbase.kde.org/Development/Tutorials/Setting_Up under 'Easy as pie: Package manager'
<!--T:7-->
Upon a Kubuntu installation is up and running, follow the instructions below.


As stated on the Wiki page, it is easier to leverage the KDE development packages provided from the Kubuntu repository than recompile everything from scratch. Most new starters will not need to go through this exercise.
==== Instructions ==== <!--T:8-->


With a
===== 1. Install additional development packages from the Kubuntu repository ===== <!--T:9-->


<!--T:10-->
Referring to the [https://techbase.kde.org/Development/Tutorials/Setting_Up Setting Up] guide under 'Easy as pie: Package manager', it is much quicker to install the KDE development packages provided from the Kubuntu repository than recompile everything from source.
<!--T:11-->
Run the following command in 'Konsole' to install additional KDE framework library and development tools:
<!--T:12-->
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo apt install libkf5syntaxhighlighting-dev cmake clang-8 libkf5config-dev libkf5auth-dev libkf5package-dev libkf5declarative-dev libkf5coreaddons-dev libkf5dbusaddons-dev libkf5kcmutils-dev libkf5i18n-dev libqt5core5a libqt5widgets5 libqt5gui5 libqt5qml5 extra-cmake-modules qtbase5-dev kirigami2-dev libkf5kirigami2-5 libkf5notifications-dev qml-module-org-kde-kirigami2 qml-module-qtquick-dialogs qml-module-qtquick-controls2 cmake build-essential gettext libkf5crash-dev libkf5doctools-dev
sudo apt install libkf5syntaxhighlighting-dev cmake clang-8 libkf5config-dev libkf5auth-dev libkf5package-dev libkf5declarative-dev libkf5coreaddons-dev libkf5dbusaddons-dev libkf5kcmutils-dev libkf5i18n-dev libqt5core5a libqt5widgets5 libqt5gui5 libqt5qml5 extra-cmake-modules qtbase5-dev kirigami2-dev libkf5kirigami2-5 libkf5notifications-dev qml-module-org-kde-kirigami2 qml-module-qtquick-dialogs qml-module-qtquick-controls2 cmake build-essential gettext libkf5crash-dev libkf5doctools-dev
</syntaxhighlight>
</syntaxhighlight>


2. Install KDevelop
===== 2. Install KDevelop===== <!--T:13-->


<!--T:14-->
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo apt install kdevelop
sudo apt install kdevelop
</syntaxhighlight>
</syntaxhighlight>


3. Install additional dependances
=====3. Create a basic KDE Application using an existing template===== <!--T:15-->
 
<!--T:16-->
[[File:Screenshot 20200616 162007.jpg|thumb|KDE C++ KDevelop Template]]
 
<!--T:17-->
Now you should be in a position to be able to create a simple KDE application in KDevelop by performing the following in the menu: Project -> New From Template -> Qt -> Graphical -> C++ KDE Framework


<syntaxhighlight lang="bash">
<!--T:18-->
sudo apt install clang-8
This example project should now compile and execute without KDevelop complaining.
sudo apt-get install libkf5config-dev libkf5auth-dev libkf5package-dev libkf5declarative-dev libkf5coreaddons-dev libkf5dbusaddons-dev libkf5kcmutils-dev libkf5i18n-dev libqt5core5a libqt5widgets5 libqt5gui5 libqt5qml5 extra-cmake-modules qtbase5-dev kirigami2-dev libkf5kirigami2-5 libkf5notifications-dev qml-module-org-kde-kirigami2 qml-module-qtquick-dialogs qml-module-qtquick-controls2 cmake build-essential gettext
sudo apt install libkf5crash-dev
sudo apt install libkf5doctools-dev
</syntaxhighlight>


4. Create a KDE Application using an existing template
<!--T:19-->
You are now up and running! It should also now be possible to use Qt Creator should this be a preferred option.


Now you should be in a position to be able to create a simple KDE application in KDevelop by following the menu:
==== Other Useful Guides and References ==== <!--T:20-->


Project -> New From Template -> Qt -> Graphical -> C++ KDE Framework
<!--T:21-->
* [https://community.kde.org/Get_Involved/development/Developing_in_a_virtual_machine Developing in a virtual machine]


This example project should now compile and execute without KDevelop complaining.
<!--T:22-->
* [https://techbase.kde.org/Development/Tutorials/First_program Building your first program]


=== Other Useful Guides and References ===
<!--T:23-->
* [https://techbase.kde.org/KDE_Frameworks#Step_1:_Install_the_Framework_you_need An Overview of the KDE Frameworks]


Developing in a virtual machine: https://community.kde.org/Get_Involved/development/Developing_in_a_virtual_machine
<!--T:24-->
Building your first program: https://techbase.kde.org/Development/Tutorials/First_program
* [https://community.kde.org/Get_Involved/development#One-time_setup:_your_development_environment Getting involved]
KDE Frameworks: https://techbase.kde.org/KDE_Frameworks#Step_1:_Install_the_Framework_you_need
</translate>
Getting involved: https://community.kde.org/Get_Involved/development#One-time_setup:_your_development_environment

Revision as of 06:24, 25 June 2020

Building your first KDE application using Kubuntu Linux 20.04

Overview

This document aims to provide an overview of the pre-requisites required to create, compile, and execute a simple KDE Application (windowed GUI application) using Kubuntu 20.04.

As most Linux distributions do not provide development packages by default, additional steps are required to get 'up and running' and be able to create a KDE Qt application, quickly.

Pre-requisites

It is assumed that a 'Minimal' installation of Kubuntu is performed. Refer to this guide on how to set up a Virtual Machine for development: https://community.kde.org/Get_Involved/development/Developing_in_a_virtual_machine

Upon a Kubuntu installation is up and running, follow the instructions below.

Instructions

1. Install additional development packages from the Kubuntu repository

Referring to the Setting Up guide under 'Easy as pie: Package manager', it is much quicker to install the KDE development packages provided from the Kubuntu repository than recompile everything from source.

Run the following command in 'Konsole' to install additional KDE framework library and development tools:

sudo apt install libkf5syntaxhighlighting-dev cmake clang-8 libkf5config-dev libkf5auth-dev libkf5package-dev libkf5declarative-dev libkf5coreaddons-dev libkf5dbusaddons-dev libkf5kcmutils-dev libkf5i18n-dev libqt5core5a libqt5widgets5 libqt5gui5 libqt5qml5 extra-cmake-modules qtbase5-dev kirigami2-dev libkf5kirigami2-5 libkf5notifications-dev qml-module-org-kde-kirigami2 qml-module-qtquick-dialogs qml-module-qtquick-controls2 cmake build-essential gettext libkf5crash-dev libkf5doctools-dev
2. Install KDevelop
sudo apt install kdevelop
3. Create a basic KDE Application using an existing template
KDE C++ KDevelop Template

Now you should be in a position to be able to create a simple KDE application in KDevelop by performing the following in the menu: Project -> New From Template -> Qt -> Graphical -> C++ KDE Framework

This example project should now compile and execute without KDevelop complaining.

You are now up and running! It should also now be possible to use Qt Creator should this be a preferred option.

Other Useful Guides and References