MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / onActiveChanged

Method onActiveChanged

app/src/Platform/NativeWindow_CSD.cpp:305–334  ·  view source on GitHub ↗

* @brief Handles the active state change of a window. */

Source from the content-addressed store, hash-verified

303 * @brief Handles the active state change of a window.
304 */
305void NativeWindow::onActiveChanged()
306{
307#if defined(Q_OS_WIN)
308 if (!isWindows11())
309 return;
310
311 auto* window = qobject_cast<QWindow*>(sender());
312 if (!window || !m_windows.contains(window))
313 return;
314
315 const auto& colors = Misc::ThemeManager::instance().colors();
316 QString colorName;
317
318 if (m_colors.contains(window) && !m_colors[window].isEmpty())
319 colorName = m_colors[window];
320
321 else if (window->isActive())
322 colorName = colors.value("toolbar_top").toString();
323 else
324 colorName = colors.value("toolbar_bottom").toString();
325
326 const QColor color(colorName);
327 const COLORREF colorref = color.red() | (color.green() << 8) | (color.blue() << 16);
328
329 const DWORD attribute = 35;
330 DwmSetWindowAttribute((HWND)window->winId(), attribute, &colorref, sizeof(colorref));
331#else
332 Q_UNUSED(this);
333#endif
334}

Callers

nothing calls this directly

Calls 6

isWindows11Function · 0.85
senderFunction · 0.85
isEmptyMethod · 0.80
containsMethod · 0.45
isActiveMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected