| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org> |
| 3 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 4 | */ |
| 5 | |
| 6 | #ifndef KLINEEDITEVENTHANDLER_H |
| 7 | #define KLINEEDITEVENTHANDLER_H |
| 8 | |
| 9 | #include <kwidgetsaddons_export.h> |
| 10 | |
| 11 | class QObject; |
| 12 | |
| 13 | /*! |
| 14 | * \namespace KLineEditEventHandler |
| 15 | * |
| 16 | * \brief Event-handling utilities for QLineEdit instances. |
| 17 | * |
| 18 | * \since 6.0 |
| 19 | */ |
| 20 | namespace KLineEditEventHandler |
| 21 | { |
| 22 | /*! |
| 23 | * Do not propagate Return or Enter key presses in line edits. |
| 24 | * |
| 25 | * QLineEdit::returnPressed() will still be emitted as normal, but the |
| 26 | * key event isn't propagated further up the widget hierarchy. This is |
| 27 | * useful to prevent closing a dialog for example. |
| 28 | */ |
| 29 | KWIDGETSADDONS_EXPORT void catchReturnKey(QObject *lineEdit); |
| 30 | |
| 31 | /*! |
| 32 | * Handle drop events with URLs and replace the current line edit with the |
| 33 | * dropped URL. |
| 34 | */ |
| 35 | KWIDGETSADDONS_EXPORT void handleUrlDrops(QObject *lineEdit); |
| 36 | }; |
| 37 | |
| 38 | #endif |
| 39 | |