aboutsummaryrefslogtreecommitdiff
path: root/src/aolineedit.cpp
blob: d80fa01442622fc9e3fa56c63f3859044bbac423 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "aolineedit.h"

AOLineEdit::AOLineEdit(QWidget *parent) : QLineEdit(parent) {}

void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e)
{
  QLineEdit::mouseDoubleClickEvent(e);

  double_clicked();
}
void AOLineEdit::focusOutEvent(QFocusEvent *ev)
{
  int start = selectionStart();
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
  int len = selectionLength();
#else
  int len = selectedText().length();
#endif
  QLineEdit::focusOutEvent(ev);
  if (p_selection && start != -1 && len != -1)
    this->setSelection(start, len);
}