[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [lokalize] src: improve navigation with up/down arrows, workaround Qt bug for completion box positio
From: Nick Shaforostoff <shafff () ukr ! net>
Date: 2016-02-21 23:52:40
Message-ID: E1aXdns-0003pz-H5 () scm ! kde ! org
[Download RAW message or body]
Git commit 2f62cde5ce53dd54c8a92210dfd19d11339a1099 by Nick Shaforostoff.
Committed on 21/02/2016 at 23:51.
Pushed by shaforo into branch 'master'.
improve navigation with up/down arrows, workaround Qt bug for completion box positioning
M +10 -4 src/xlifftextedit.cpp
http://commits.kde.org/lokalize/2f62cde5ce53dd54c8a92210dfd19d11339a1099
diff --git a/src/xlifftextedit.cpp b/src/xlifftextedit.cpp
index 0c3fecd..cce61cf 100644
--- a/src/xlifftextedit.cpp
+++ b/src/xlifftextedit.cpp
@@ -759,8 +759,12 @@ void TranslationUnitTextEdit::keyPressEvent(QKeyEvent *keyEvent)
QTextCursor c=textCursor();
if (!c.movePosition(up?QTextCursor::Up:QTextCursor::Down))
{
- if (up) emit gotoPrevRequested();
- else emit gotoNextRequested();
+ QTextCursor::MoveOperation op;
+ if (up && !c.atStart()) op = QTextCursor::Start;
+ else if (!up && !c.atEnd()) op = QTextCursor::End;
+ else if (up) { emit gotoPrevRequested(); op = QTextCursor::End;}
+ else { emit gotoNextRequested(); op = QTextCursor::Start;}
+ c.movePosition(op);
}
setTextCursor(c);
}
@@ -1369,8 +1373,10 @@ void TranslationUnitTextEdit::doCompletion(int pos)
if (!m_completionBox->isVisible()) //NOTE remove the check if kdelibs gets adapted
m_completionBox->show();
m_completionBox->resize(m_completionBox->sizeHint());
- qDebug()<<viewport()->mapToGlobal(cursorRect().bottomRight());
- m_completionBox->move(viewport()->mapToGlobal(cursorRect().bottomRight()));
+ QPoint p = cursorRect().bottomRight();
+ if (p.x()<10) //workaround Qt bug
+ p.rx() += textCursor().verticalMovementX() + QFontMetrics(currentFont()).width('W');
+ m_completionBox->move(viewport()->mapToGlobal(p));
}
else
m_completionBox->hide();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic