KLineEditEventHandler Namespace

Event-handling utilities for QLineEdit instances. More...

Header: #include <KLineEditEventHandler>
CMake: find_package(KF6 REQUIRED COMPONENTS WidgetsAddons)
target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons)
Since: 6.0

Functions

void catchReturnKey(QObject *lineEdit)
void handleUrlDrops(QObject *lineEdit)

Detailed Description

Function Documentation

void KLineEditEventHandler::catchReturnKey(QObject *lineEdit)

Do not propagate Return or Enter key presses in line edits.

QLineEdit::returnPressed() will still be emitted as normal, but the key event isn't propagated further up the widget hierarchy. This is useful to prevent closing a dialog for example.

void KLineEditEventHandler::handleUrlDrops(QObject *lineEdit)

Handle drop events with URLs and replace the current line edit with the dropped URL.