diff options
| author | Kai Uwe Broulik <[email protected]> | 2022-07-05 13:18:45 +0200 |
|---|---|---|
| committer | Kai Uwe Broulik <[email protected]> | 2022-07-06 17:33:42 +0000 |
| commit | 5ebc6b865de31b84faa353f6a85a76734c06ebe4 (patch) | |
| tree | 89e2e39b63f78b076a97c3d064e65f700bbc0dc2 /src/views/dolphinview.cpp | |
| parent | f3a0986b8b1addabb93323ac850060ffa0a8c5bd (diff) | |
Don't reinterpret_cast QEvent
We know that we'll be a `QHelpEvent` from `QEvent::ToolTip`, so do a
static_cast from the event handler (where it's obvious from context),
and then pass it along to `tryShowNameToolTip`.
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 168e282b5..a6c90e990 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -925,7 +925,7 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event) break; case QEvent::ToolTip: - tryShowNameToolTip(event); + tryShowNameToolTip(static_cast<QHelpEvent*>(event)); default: break; @@ -2196,11 +2196,10 @@ void DolphinView::updatePlaceholderLabel() m_placeholderLabel->setVisible(true); } -void DolphinView::tryShowNameToolTip(QEvent* event) +void DolphinView::tryShowNameToolTip(QHelpEvent* event) { if (!GeneralSettings::showToolTips() && m_mode == DolphinView::IconsView) { - QHelpEvent *hoverEvent = reinterpret_cast<QHelpEvent *>(event); - const std::optional<int> index = m_view->itemAt(hoverEvent->pos()); + const std::optional<int> index = m_view->itemAt(event->pos()); if (!index.has_value()) { return; @@ -2212,7 +2211,7 @@ void DolphinView::tryShowNameToolTip(QEvent* event) if(isElided) { const KFileItem item = m_model->fileItem(index.value()); const QString text = item.text(); - const QPoint pos = mapToGlobal(hoverEvent->pos()); + const QPoint pos = mapToGlobal(event->pos()); QToolTip::showText(pos, text); } } |
