Sayonara Player
TagLineEdit.h
1 /* TagLineEdit.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef TAGLINEEDIT_H
22 #define TAGLINEEDIT_H
23 
24 #include <QLineEdit>
25 
31 {
32  int selection_start;
33  int selection_size;
34 
38  void reset()
39 {
40  selection_start = -1;
41  selection_size = 0;
42  }
43 
45 {
46  reset();
47  }
48 };
49 
54 class TagLineEdit :
55  public QLineEdit
56 {
57  Q_OBJECT
58 
59 public:
60  explicit TagLineEdit(QWidget* parent=nullptr);
61  ~TagLineEdit();
62 
63 protected:
64 
65  TextSelection _text_selection;
66 
67 protected:
72  void focusInEvent(QFocusEvent* e) override;
73 
78  void focusOutEvent(QFocusEvent* e) override;
79 
80 public:
85  TextSelection get_text_selection() const;
86 };
87 
88 #endif // TAGLINEEDIT_H
Holds start and size of a selection.
Definition: TagLineEdit.h:30
The TagLineEdit class.
Definition: TagLineEdit.h:54
void reset()
set selection_start to -1 and selection_size to 0
Definition: TagLineEdit.h:38