mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
* 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:
parent
098dc1f93b
commit
50b994b08f
@ -494,19 +494,26 @@ void GuiWorkArea::adjustViewWithScrollBar(int action)
|
||||
|
||||
bool GuiWorkArea::event(QEvent * e)
|
||||
{
|
||||
if (e->type() == QEvent::ToolTip) {
|
||||
QHelpEvent * helpEvent = static_cast<QHelpEvent *>(e);
|
||||
if (!lyxrc.use_tooltip)
|
||||
return QAbstractScrollArea::event(e);
|
||||
QPoint pos = helpEvent->pos();
|
||||
if (pos.x() < viewport()->width()) {
|
||||
QString s = toqstr(buffer_view_->toolTip(pos.x(), pos.y()));
|
||||
QToolTip::showText(helpEvent->globalPos(), s);
|
||||
}
|
||||
else
|
||||
QToolTip::hideText();
|
||||
}
|
||||
return QAbstractScrollArea::event(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::ToolTip: {
|
||||
QHelpEvent * helpEvent = static_cast<QHelpEvent *>(e);
|
||||
if (lyxrc.use_tooltip) {
|
||||
QPoint pos = helpEvent->pos();
|
||||
if (pos.x() < viewport()->width()) {
|
||||
QString s = toqstr(buffer_view_->toolTip(pos.x(), pos.y()));
|
||||
QToolTip::showText(helpEvent->globalPos(), s);
|
||||
}
|
||||
else
|
||||
QToolTip::hideText();
|
||||
}
|
||||
// Don't forget to accept the event!
|
||||
e->accept();
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return QAbstractScrollArea::event(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user