Allow middle-click to open new tab when text is selected
If text is selected, middle-click will not be forwarded to the function that opens the link in a new tab. So this change will deselect any selected text before trying to open a new tab. Fixes #253
This commit is contained in:
parent
d937a0c32e
commit
d47e3d3f54
|
@ -48,6 +48,9 @@ KristallTextBrowser::KristallTextBrowser(QWidget *parent) :
|
|||
void KristallTextBrowser::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if(event->button() == Qt::MiddleButton) {
|
||||
// Deselect any selection. Otherwise the click won't register.
|
||||
setTextCursor(cursorForPosition(event->pos()));
|
||||
|
||||
// Fake a middle-click event here
|
||||
QMouseEvent fake_event {
|
||||
event->type(),
|
||||
|
|
Loading…
Reference in New Issue