1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[TabBar] Show tooltips on tabs when tab previews are disabled

This commit is contained in:
nowrep 2014-01-09 10:22:06 +01:00
parent db4c05d204
commit 2d2f198846

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * QupZilla - WebKit based browser
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com> * Copyright (C) 2010-2014 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
@ -38,7 +38,7 @@
#include <QRect> #include <QRect>
#include <QScrollArea> #include <QScrollArea>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QDebug> #include <QToolTip>
TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget) TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
: ComboTabBar() : ComboTabBar()
@ -659,6 +659,17 @@ void TabBar::mouseReleaseEvent(QMouseEvent* event)
bool TabBar::event(QEvent* event) bool TabBar::event(QEvent* event)
{ {
switch (event->type()) { switch (event->type()) {
case QEvent::ToolTip:
if (!m_showTabPreviews) {
QHelpEvent *ev = static_cast<QHelpEvent*>(event);
int index = tabAt(ev->pos());
if (index >= 0) {
QToolTip::showText(mapToGlobal(ev->pos()), tabToolTip(index));
}
}
break;
case QEvent::Leave: case QEvent::Leave:
if (!rect().contains(mapFromGlobal(QCursor::pos()))) { if (!rect().contains(mapFromGlobal(QCursor::pos()))) {
hideTabPreview(); hideTabPreview();