Marble

MarbleLineEdit.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // The code in this file is largely based on KDE's KLineEdit class
4 // as included in KDE 4.5. See there for its authors:
5 // https://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/klineedit_8cpp.html
6 //
7 // SPDX-FileCopyrightText: 2010, 2012 Dennis Nienhüser <[email protected]>
8 //
9 
10 #ifndef MARBLE_MARBLELINEEDIT_H
11 #define MARBLE_MARBLELINEEDIT_H
12 
13 #include "marble_export.h"
14 
15 #include <QLineEdit>
16 
17 namespace Marble
18 {
19 
20 class MarbleLineEditPrivate;
21 
22 /**
23  * A QLineEdit with an embedded clear button. The clear button removes any input
24  * in the line edit when clicked with the left mouse button. It replaces the line
25  * edit input with the current clipboard content on a middle mouse button click.
26  */
27 class MARBLE_EXPORT MarbleLineEdit : public QLineEdit
28 {
29  Q_OBJECT
30 
31 public:
32  /** Constructor */
33  explicit MarbleLineEdit( QWidget *parent = nullptr );
34 
35  /** Destructor */
36  ~MarbleLineEdit() override;
37 
38  void setDecorator( const QPixmap &decorator );
39 
40  void setBusy( bool busy );
41 
42 Q_SIGNALS:
43  /** The clear button was clicked with the left mouse button */
44  void clearButtonClicked();
45 
46  void decoratorButtonClicked();
47 
48 protected:
49  void mouseReleaseEvent( QMouseEvent* event ) override;
50 
51  void resizeEvent( QResizeEvent* event ) override;
52 
53 private Q_SLOTS:
54  void updateClearButtonIcon( const QString& text );
55 
56  void updateClearButton();
57 
58  void updateProgress();
59 
60 private:
61  MarbleLineEditPrivate* const d;
62 };
63 
64 } // namespace Marble
65 
66 #endif // MARBLE_MARBLELINEEDIT_H
A QLineEdit with an embedded clear button.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Oct 4 2023 04:09:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.