-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditableButton.h
More file actions
43 lines (35 loc) · 946 Bytes
/
Copy pathEditableButton.h
File metadata and controls
43 lines (35 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef EDITABLEBUTTON_H
#define EDITABLEBUTTON_H
#include <QPushButton>
#include <QLineEdit>
class EditableButtonLineEdit;
class EditableButton : public QPushButton
{
Q_OBJECT
public:
EditableButton(QWidget* parent=nullptr);
Q_SIGNALS:
/**
* @brief textChanged signal emitted when edit finished.
* @param text the new text write to QPushButton
*/
void textChanged(const QString text);
private:
EditableButtonLineEdit* mEdit; ///< LineEdit
void createEditLabel();
void destroyEditLabel();
private Q_SLOTS:
void onEditFinished();
protected:
virtual void mouseDoubleClickEvent(QMouseEvent* ev) override;
virtual void focusOutEvent(QFocusEvent* ev) override;
};
class EditableButtonLineEdit : public QLineEdit
{
Q_OBJECT
public:
EditableButtonLineEdit(QWidget* parent=nullptr);
protected:
virtual void focusOutEvent(QFocusEvent* ev) override;
};
#endif // EDITABLEBUTTON_H