Pages
API Documentation
On this page

KGuiAddons

Additions to Qt Gui.

KGuiAddons are addons to QtGui. They provide utilities for graphical user interfaces in the areas of colors, fonts, text, images, and keyboard input.

Color utilities

The KColorUtils namespace contains various small utilities to work with colors. KColorCollection provides handling of color collections ("pallettes"). KColorMimeData adds drag-and-drop and clipboard mimedata manipulation to QColor objects

Text utilities

KWordWrap is a special word wrapping algorithm that takes beauty into account. It can be used directly with QPainter or can return the wrapped text in a QString.

KDateValidator is a QValidator that validates user-entered dates.

KFontUtils::adaptFontSize() is a function that calculates the biggest font size (in points) that can be used to draw a text centered in a rectangle using word wrapping.

Keyboard utilities

KKeySequenceRecorder is a utility that records a QKeySequence by listening to key events in a window. This can be used to let the user modify predefined keyboard shortcuts for example.

Icon utilities

KIconUtils contains functions to add overlays on top of a QIcon.

Cursor utilities

KCursorSaver is used to temporarily set a mouse cursor and restore the previous one on destruction.

Using the Module

Using a Qt module's C++ API requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake.

Building with CMake

Use the find_package() command to locate the needed module component in the Qt6 package:

find_package(Qt6 REQUIRED COMPONENTS KF6)
target_link_libraries(mytarget PRIVATE Qt6::KF6)

For more details, see the Build with CMake overview.

API Reference

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.