| 90 | } |
| 91 | |
| 92 | bool MacroTreeItem::event(QEvent *event) |
| 93 | { |
| 94 | if (event->type() != QEvent::ToolTip) { |
| 95 | return QFrame::event(event); |
| 96 | } |
| 97 | |
| 98 | if (_macro->IsGroup()) { |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | QString text; |
| 103 | if (!_macro->WasExecutedSince({})) { |
| 104 | text = obs_module_text( |
| 105 | "AdvSceneSwitcher.macroTab.macroNotYetExecutedTooltip"); |
| 106 | } else { |
| 107 | const QString formatStr = obs_module_text( |
| 108 | "AdvSceneSwitcher.macroTab.macroLastExecutedTooltip"); |
| 109 | const auto secondsSinceLastRun = |
| 110 | std::chrono::duration_cast<std::chrono::seconds>( |
| 111 | std::chrono::high_resolution_clock::now() - |
| 112 | _macro->GetLastExecutionTime()); |
| 113 | text = formatStr.arg(secondsSinceLastRun.count()); |
| 114 | } |
| 115 | |
| 116 | auto helpEvent = static_cast<QHelpEvent *>(event); |
| 117 | QToolTip::showText(helpEvent->globalPos(), text, this); |
| 118 | return true; |
| 119 | } |
| 120 | |
| 121 | void MacroTreeItem::EnableHighlight(bool enable) |
| 122 | { |
nothing calls this directly
no test coverage detected