Nova Flow OS
KDE Developer Platform
KDE Developer Platform
  • KDE Developer Platform
    • Getting started
      • Building KDE software
        • KDE software
        • Where to find the development team
        • Learning more
        • Choose what to work on
        • Source code cross-referencing
        • Installing build dependencies
        • Set up a development environment
        • Building KDE software with kdesrc-build
        • Basic troubleshooting
        • Tips and tricks
        • IDE Configuration
          • Setting up an IDE for KDE development
          • Visual Studio Code
          • Qt Creator
          • Kate
          • KDevelop
          • CLion
          • Sublime Text
        • Building KDE software manually
        • Building KDE software with distrobox and podman
      • Kirigami
        • KDE is ours
        • Setting up and getting started
        • Explaining pages
        • Layouts, ListViews, and Cards
        • Adding actions
        • Adding a dialog
        • Using separate files
        • Next steps
        • Colors and themes in Kirigami
        • Typography
        • Actions based components
        • Page rows and page stacks
        • Scrollable pages and list views
        • Cards
        • Drawers
        • Chips
        • Dialog types
        • Controls and interactive elements
        • Form layouts
        • Inline messages
        • Action toolbars
        • Progress bars and indicators
        • List views
        • Understanding CMakeLists
        • Figuring out main.cpp
        • Connect logic to your QML user interface
        • Connect models to your QML user interface
        • About page
        • Introduction to Kirigami Addons
        • FormCard About pages
        • Form delegates in your settings pages
      • KXmlGui
        • Getting started with KXmlGui
        • Hello World!
        • Creating the main window
        • Using actions
        • Saving and loading
        • Command line interface
      • Python with Kirigami
        • Apps with QML and Python
        • Your first Python + Kirigami application
        • Creating a Python package
        • Creating a Flatpak
      • Common programming mistakes
      • Adding a new KDE project
    • Features
      • Icons
      • Configuration
        • The KConfig Framework
        • Introduction to KConfig
        • Using KConfig XT
        • KDE Frameworks 6 porting guide
        • Settings module (KCM) development
        • KConfigDialog
      • D-Bus
        • What is D-Bus practically useful for?
        • Introduction to D-Bus
        • Accessing D-Bus interfaces
        • Intermediate D-Bus
        • Creating D-Bus interfaces
        • Using custom types with D-Bus
        • D-Bus autostart services
      • Create your own mouse cursor theme
      • Session management
      • Archives
      • Desktop file
      • KAuth
        • Privilege Escalation
        • Using actions in your applications
      • KIdleTime
      • Akonadi: personal information management
        • Debugging Akonadi Resources
        • Using Akonadi in applications
      • Concurrent programming
      • Solid
      • Sonnet
    • Plasma themes and plugins
      • Getting started
      • Plasma Widget tutorial
        • How to create a plasmoid
        • Setup
        • Porting Plasmoids to KF6
        • Testing
        • QML
        • Plasma's QML API
        • Widget Properties
        • Configuration
        • Translations / i18n
        • Examples
        • C++ API
      • KWin Effects
      • Plasma Desktop scripting
        • Javascript Interaction With Plasma Shells
        • Templates
        • Examples
        • API documentation
        • Configuration keys
      • Plasma Style tutorial
        • Creating a Plasma Style quickstart
        • Understanding Plasma Styles
        • SVG elements and Inkscape
        • Background SVG format
        • System and accent colors
        • Theme elements reference
        • Porting themes to Plasma 5
        • Porting themes to Plasma 6
      • Aurorae window decorations
      • KWin scripting tutorial
        • Quick start
        • KWin scripting API
      • Wallpapers
      • Plasma comic
        • Tutorial
        • Testing and debugging
        • Examples
      • Create a custom Window Switcher
      • KRunner C++ Plugin
        • Basic Anatomy of a Runner
        • KRunner metadata format
    • Applications
      • Creating sensor faces
      • Dolphin
        • Creating Dolphin service menus
      • Kate
        • Kate plugin tutorial
      • KMines
        • Making a KMines theme
      • Writing tests
        • Appium automation testing
    • Packaging
      • Android
        • KDE on Android
        • Building applications for Android
        • Packaging and publishing applications for Android
        • Publishing on Google Play
          • Introduction
          • Packaging your app
          • Adding your app to Google Play
          • Publishing your app
          • Releasing new versions of old apps
        • Porting applications to Android
          • Basic porting
          • Making applications run well on Android
          • Metadata
      • Windows
        • Packaging and publishing applications for Windows
        • Publish your app in the Microsoft Store
          • Packaging your app for the Microsoft Store
          • Submitting your app to the Microsoft Store
      • Plasma Mobile
        • KDE on mobile devices
        • Porting a new device to Plasma Mobile
        • KDE Telephony stack
          • General Overview
          • Kernel layer
          • System daemons
            • General overview
            • Developing Telephony functionality
            • ModemManager Telephony functions
          • Session daemons
          • QML declarative plugin layer
          • KDE application layer
        • Execute applications
      • Distributing KDE software as Flatpak
        • Your first Flatpak
        • Extending your package
        • Nightly Flatpaks and Flathub
        • Testing your Flatpak
    • System administration
      • Shell scripting with KDE dialogs
      • Kiosk: Simple configuration management for large deployment
        • Abstract
        • Introduction to Kiosk
        • Kiosk keys
    • Contribute to the documentation
    • About
      • Readme
      • License
        • Creative Commons Attribution-ShareAlike 4.0 International
        • GNU General Public License 3.0 or later
Powered by GitBook
On this page
  • Install CLion
  • KDE Builder configuration
  • Using generated project in CLion
  • Tips and Tricks
  1. KDE Developer Platform
  2. Getting started
  3. Building KDE software
  4. IDE Configuration

CLion

C++ IDE from JetBrains.

PreviousKDevelopNextSublime Text

Last updated 8 months ago

is a proprietary IDE for C++ from JetBrains.

This article will show you how to configure and develop KDE projects in CLion. We will use KCalc as an example project.

Install CLion

Follow the documentation.

If you are using Arch Linux, you can install the AUR package or .

Note

This article assumes you use KDE Builder. The older tool kdesrc-build does not support CLion configuration generation.

KDE Builder configuration

To allow kde-builder to generate CLion project files, add the following to your ~/.config/kdesrc-buildrc:

global
  # other options
  generate-clion-project-config true
end global

Instead of enabling the generate-clion-project-config option globally, you may choose to enable it only for a single project:

options kcalc
  generate-clion-project-config true
end options

Ensure you have successfully built kcalc following the kde-builder instructions.

In case you enabled generate-clion-project-config after you have built kcalc previously, or do not want to edit your config, you can generate CLion configs by running:

kde-builder kcalc --no-include-dependencies --no-src --build-system-only --generate-clion-project-config

Using generated project in CLion

Opening project

From the CLion main menu, select File | Open.

An "Open File or Project" dialog will show up. Choose ~/kde/src/kcalc directory and press OK.

{{< figure alt="Selecting directory in Open File or Project window" width="400px" src="open-file-or-project-directory.png" >}}

Alternative ways of opening projects

If you have not yet opened any projects, or you have disabled "Reopen projects on startup" setting, when starting CLion, you will see a "Welcome to Clion" window. Press the "Open" button.

{{< figure alt="Open button in Welcome to Clion window" width="400px" src="open-from-welcome-to-clion-window.png" >}}

In "Open or Import Project" dialog, you can also select the root CMakeLists.txt file (i.e. ~/kde/src/kcalc/CMakeLists.txt) and choose to open it as a project.

{{< compare >}} {{< figure alt="Selecting cmakelists in Open File or Project window" width="400px" src="open-file-or-project-cmakelists.png" >}}

{{< figure alt="open as cmake project" width="500px" src="open-cmakelists-as-project.png" >}}

{{< /compare >}}

Selecting CMake Profile

The "Open Project Wizard" window will open:

{{< figure alt="Open Project Wizard window" width="800px" src="open-project-wizard-window.png" >}}

Tip You can reach these settings later by going to **Settings | Build, Execution, Deployment | CMake**.

If the project has a CMakePresets.json in its root directory (KCalc does), you will see many greyed-out CMake Profiles. They are read only, and disabled by default. You do not need them. Scroll the list down to be able to see the "KDE Builder cmake profile", which you want to select.

The very first time you use a kde-builder generated CLion project, you will need to create a toolchain named "KDE Builder toolchain". Press "Manage toolchains" link, and follow the next section instructions.

If you have done that, proceed by pressing OK.

Creating the toolchain

Tip This is a global IDE setting, so you will only need to do it once.

The "Toolchains" window will appear:

{{< figure alt="Toolchains window" width="700px" src="kb-toolchain-creation.png" >}}

Tip You can reach these settings later by going to **Settings | Build, Execution, Deployment | Toolchains**.

  • Press "+" icon, and select "System" from the list.

  • In the Name field, enter exactly "KDE Builder toolchain".

  • In the CMake field, enter "cmake".

  • In the Debugger field, select "Custom GDB executable" and enter "gdb".

You can specify the full path to the tools or use bundled tools for CMake and GDB. But note that the toolchain name should be exactly that, because it is used in generated project configurations.

Press OK.

Selecting Run/Debug Configuration

In the upper right corner of CLion's window, you will see that "KDE Builder cmake profile" is applied, and "KDE Builder run/debug configuration" is applied.

{{< figure alt="IDE window with selected run configuration" width="900px" src="kb-run-debug-conf-applied.png" >}}

You can now start developing. Set a breakpoint, start a debugging session, create your own run/debug configuration based on original, and so on.

Tips and Tricks

JetBrains Dolphin Plugin

You can install it from the store.kde.org (in the Configure Dolphin choose Context Menu, then press Download New Services... button. Search for Jetbrains Dolphin Plugin by alex1701c).

{{< figure width="500px" src="jb-dolphin-plugin.png" >}}

JetBrains Runner

{{< figure width="500px" src="jb-runner-plugin.png" >}}

Plugins for CLion

Qt6Renderer

GNU GetText files support (*.po)

For example, you search the strings in local language, to find the place in code where it is used, you find it in *.po files. They contain stanzas like this:

#: part/part.cpp:132
#, kde-format
msgid "Comment has been modified."
msgstr "Комментарий был изменен."

You want to quickly jump to the source file. That source file (part/part.cpp:132) becomes a clickable link if you install the plugin.

Non-project executable to run

When developing a library, it may be convenient to launch some application that uses it, from the current project. For example, you work with Ark's libraries used in Dolphin context menu actions. You can make your run configuration to launch custom binary - dolphin.

To do that, do the following:

  • Open Run/Debug Configurations window

  • Click "Copy" icon to create a new run configuration based on the run configuration we have generated with kde-builder.

The new configuration will appear.

  • Give it a meaningful name, for example ark (run dolphin).

  • In the Executable field, specify path to dolphin binary: /home/username/kde/build/dolphin/bin/dolphin.

  • Press OK.

Now when you run this configuration, the Ark will be built, but Dolphin will be launched.

Use native titlebar with New UI

It is possible to show a normal window titlebar. For this, open the registry (double-tap Shift, search for "Registry") and disable the property ide.linux.hide.native.title.

Use KWallet for git credentials

You need to enable this key in Registry: credentialStore.linux.prefer.kwallet. It allows to use KWallet if KWallet and SecretService are both available.

Note See the developer documentation in KDE Builder for details about [config generation for CLion](https://kde-builder.kde.org/en/developer/ide-configs-generation.html#clion).

is a service menu plugin (context menu action) which allows you to easily open folders as IDE projects.

If you are using Arch Linux, you will prefer to install from AUR: .

You can install search plugin to be able to quickly open recent projects in JetBrains IDEs.

If you are using Arch Linux, you will prefer to install from AUR: .

Currently, the Qt classes do not support pretty printing in debugger in CLion out of the box. See for more information.

You can install plugin.

Install the plugin. It will make the source lines in the po files clickable.

CLion
Install CLion
clion
clion-eap
JetBrains Dolphin Plugin
kf6-servicemenus-jetbrains-dolphin-plugin-git
JetBrainsRunner
plasma6-runners-jetbrains-runner-git
Bug CPP-605
Qt6Renderer
GetText files support (*.po)