ui: fixed search bar click

This commit is contained in:
mlangkabel
2017-10-25 17:13:21 +02:00
committed by Eberhard Graether
parent ee11528ddf
commit 6b4cc4e7e9
3 changed files with 16 additions and 2 deletions
+2
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# get the current directory
SOURCE="${0}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
+13 -2
View File
@@ -472,10 +472,10 @@ void QtSmartSearchBox::mouseMoveEvent(QMouseEvent* event)
void QtSmartSearchBox::mousePressEvent(QMouseEvent* event)
{
QLineEdit::mousePressEvent(event);
if (!m_ignoreNextMousePress)
{
QLineEdit::mousePressEvent(event);
m_mousePressed = true;
m_mouseX = event->x();
}
@@ -609,6 +609,12 @@ void QtSmartSearchBox::onAutocompletionActivated(const SearchMatch& match)
void QtSmartSearchBox::onElementSelected(QtSearchElement* element)
{
if (m_ignoreNextMousePress)
{
m_ignoreNextMousePress = false;
return;
}
if (!hasSelectedElements() && !m_shiftKeyDown)
{
editElement(element);
@@ -756,6 +762,11 @@ SearchMatch QtSmartSearchBox::editElement(QtSearchElement* element)
void QtSmartSearchBox::updateElements()
{
m_oldElements = m_elements;
for (auto e : m_oldElements)
{
e->hide();
}
m_elements.clear();
ColorScheme* scheme = ColorScheme::getInstance().get();
@@ -109,6 +109,7 @@ private:
SearchMatch m_oldMatch;
std::vector<std::shared_ptr<QtSearchElement>> m_elements;
std::vector<std::shared_ptr<QtSearchElement>> m_oldElements;
size_t m_cursorIndex;