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
* 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
* it under the terms of the GNU General Public License as published by
@ -38,7 +38,7 @@
#include <QRect>
#include <QScrollArea>
#include <QHBoxLayout>
#include <QDebug>
#include <QToolTip>
TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
: ComboTabBar()
@ -659,6 +659,17 @@ void TabBar::mouseReleaseEvent(QMouseEvent* event)
bool TabBar::event(QEvent* event)
{
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:
if (!rect().contains(mapFromGlobal(QCursor::pos()))) {
hideTabPreview();