swift
lineedithistory.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_LINEEDITHISTORY_H
7 #define SWIFT_GUI_LINEEDITHISTORY_H
8 
9 #include <QLineEdit>
10 #include <QStringList>
11 
12 #include "gui/swiftguiexport.h"
13 
14 namespace swift::gui
15 {
20  class SWIFT_GUI_EXPORT CLineEditHistory : public QLineEdit
21  {
22  Q_OBJECT
23 
24  public:
26  using QLineEdit::QLineEdit;
27 
29  QString getLastEnteredLine() const;
30 
32  QString getLastEnteredLineFormatted() const;
33 
35  void clearHistory();
36 
37  signals:
41 
42  protected:
44  virtual void keyPressEvent(QKeyEvent *event) override;
45 
47  virtual void contextMenuEvent(QContextMenuEvent *event) override;
48 
49  private:
50  QStringList m_history;
51  int m_position = 0;
52  };
53 } // namespace swift::gui
54 
55 #endif // SWIFT_GUI_LINEEDITHISTORY_H
Line edit with history.
void returnPressedUnemptyLine()
Return has been pressed, line is NOT empty (spaces are trimmed)
GUI related classes.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.