atrooney-online-2/src/aolineedit.cpp
windrammer abe80513d8
Add Qt 5.9 compatibility (#202)
* Added Ubuntu 18 backwards compatibility

Co-authored-by: Cents02 <Cents02@Cents0.me>
2020-07-29 17:43:33 -05:00

23 lines
533 B
C++

#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);
}