mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
[Fix] Bad behaviour on clicking into selected text in locationbar.
Closes #751
This commit is contained in:
parent
d81b77a004
commit
fcbf1e636b
@ -453,10 +453,10 @@ void LocationBar::mouseDoubleClickEvent(QMouseEvent* event)
|
|||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton && qzSettings->selectAllOnDoubleClick) {
|
if (event->button() == Qt::LeftButton && qzSettings->selectAllOnDoubleClick) {
|
||||||
selectAll();
|
selectAll();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
QLineEdit::mouseDoubleClickEvent(event);
|
QLineEdit::mouseDoubleClickEvent(event);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationBar::mousePressEvent(QMouseEvent* event)
|
void LocationBar::mousePressEvent(QMouseEvent* event)
|
||||||
@ -469,6 +469,24 @@ void LocationBar::mousePressEvent(QMouseEvent* event)
|
|||||||
LineEdit::mousePressEvent(event);
|
LineEdit::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocationBar::mouseReleaseEvent(QMouseEvent* event)
|
||||||
|
{
|
||||||
|
// Workaround issue in QLineEdit::setDragEnabled
|
||||||
|
// It will incorrectly set cursor position at the end
|
||||||
|
// of selection when clicking into selected text
|
||||||
|
bool wasSelectedText = !selectedText().isEmpty();
|
||||||
|
|
||||||
|
LineEdit::mouseReleaseEvent(event);
|
||||||
|
|
||||||
|
bool isSelectedText = !selectedText().isEmpty();
|
||||||
|
|
||||||
|
if (wasSelectedText && !isSelectedText) {
|
||||||
|
QMouseEvent ev(QEvent::MouseButtonPress, event->pos(), event->button(),
|
||||||
|
event->buttons(), event->modifiers());
|
||||||
|
mousePressEvent(&ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LocationBar::keyPressEvent(QKeyEvent* event)
|
void LocationBar::keyPressEvent(QKeyEvent* event)
|
||||||
{
|
{
|
||||||
switch (event->key()) {
|
switch (event->key()) {
|
||||||
|
@ -95,6 +95,7 @@ private:
|
|||||||
void focusOutEvent(QFocusEvent* event);
|
void focusOutEvent(QFocusEvent* event);
|
||||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
|
void mouseReleaseEvent(QMouseEvent* event);
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent* event);
|
||||||
void keyReleaseEvent(QKeyEvent* event);
|
void keyReleaseEvent(QKeyEvent* event);
|
||||||
void dropEvent(QDropEvent* event);
|
void dropEvent(QDropEvent* event);
|
||||||
|
@ -387,3 +387,21 @@ void WebSearchBar::keyPressEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
LineEdit::keyPressEvent(event);
|
LineEdit::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebSearchBar::mouseReleaseEvent(QMouseEvent* event)
|
||||||
|
{
|
||||||
|
// Workaround issue in QLineEdit::setDragEnabled
|
||||||
|
// It will incorrectly set cursor position at the end
|
||||||
|
// of selection when clicking into selected text
|
||||||
|
bool wasSelectedText = !selectedText().isEmpty();
|
||||||
|
|
||||||
|
LineEdit::mouseReleaseEvent(event);
|
||||||
|
|
||||||
|
bool isSelectedText = !selectedText().isEmpty();
|
||||||
|
|
||||||
|
if (wasSelectedText && !isSelectedText) {
|
||||||
|
QMouseEvent ev(QEvent::MouseButtonPress, event->pos(), event->button(),
|
||||||
|
event->buttons(), event->modifiers());
|
||||||
|
mousePressEvent(&ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -76,6 +76,7 @@ private:
|
|||||||
void focusOutEvent(QFocusEvent* e);
|
void focusOutEvent(QFocusEvent* e);
|
||||||
void dropEvent(QDropEvent* event);
|
void dropEvent(QDropEvent* event);
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent* event);
|
||||||
|
void mouseReleaseEvent(QMouseEvent* event);
|
||||||
|
|
||||||
void completeMenuWithAvailableEngines(QMenu* menu);
|
void completeMenuWithAvailableEngines(QMenu* menu);
|
||||||
void contextMenuEvent(QContextMenuEvent* event);
|
void contextMenuEvent(QContextMenuEvent* event);
|
||||||
|
Loading…
Reference in New Issue
Block a user