* GuiWorkArea::event():

- case ToolTip: don't forget to accept the event!
- Clean up the method in order to extend to other events.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22473 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-01-10 08:19:54 +00:00
parent 098dc1f93b
commit 50b994b08f

View File

@ -494,19 +494,26 @@ void GuiWorkArea::adjustViewWithScrollBar(int action)
bool GuiWorkArea::event(QEvent * e) bool GuiWorkArea::event(QEvent * e)
{ {
if (e->type() == QEvent::ToolTip) { switch (e->type()) {
QHelpEvent * helpEvent = static_cast<QHelpEvent *>(e); case QEvent::ToolTip: {
if (!lyxrc.use_tooltip) QHelpEvent * helpEvent = static_cast<QHelpEvent *>(e);
return QAbstractScrollArea::event(e); if (lyxrc.use_tooltip) {
QPoint pos = helpEvent->pos(); QPoint pos = helpEvent->pos();
if (pos.x() < viewport()->width()) { if (pos.x() < viewport()->width()) {
QString s = toqstr(buffer_view_->toolTip(pos.x(), pos.y())); QString s = toqstr(buffer_view_->toolTip(pos.x(), pos.y()));
QToolTip::showText(helpEvent->globalPos(), s); QToolTip::showText(helpEvent->globalPos(), s);
} }
else else
QToolTip::hideText(); QToolTip::hideText();
} }
return QAbstractScrollArea::event(e); // Don't forget to accept the event!
e->accept();
return true;
}
default:
return QAbstractScrollArea::event(e);
}
return false;
} }