From e56938b4bb244dfccdb78aed66c842d65fe64c14 Mon Sep 17 00:00:00 2001 From: Dan Cape Date: Tue, 6 Oct 2015 14:00:15 -0400 Subject: QLineEdit: Unable to drag selected text when aligned right or center Created local inSelection function to modify the x value (similar to xToPos()) before sending it to the control. Ran the QLineEdit test and manually tested with AlignLeft, AlignRight and AlignCenter. Change-Id: I088430580dc87f3cfff90c4cd9ff90e6ab215f57 Task-number: QTBUG-48495 Reviewed-by: Friedemann Kleint Reviewed-by: Giuseppe D'Angelo --- src/widgets/widgets/qlineedit_p.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/widgets/widgets/qlineedit_p.cpp') diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index a68f5a41ed..e6dd4b8f3b 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -70,6 +70,12 @@ int QLineEditPrivate::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const return control->xToPos(x, betweenOrOn); } +bool QLineEditPrivate::inSelection(int x) const +{ + x -= adjustedContentsRect().x() - hscroll + horizontalMargin; + return control->inSelection(x); +} + QRect QLineEditPrivate::cursorRect() const { return adjustedControlRect(control->cursorRect()); -- cgit v1.2.3