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

Method setupTitleBar

app/src/Platform/CSD.cpp:1047–1083  ·  view source on GitHub ↗

* @brief Creates and configures the title bar. */

Source from the content-addressed store, hash-verified

1045 * @brief Creates and configures the title bar.
1046 */
1047void Window::setupTitleBar()
1048{
1049 auto* quickWindow = qobject_cast<QQuickWindow*>(m_window.data());
1050 if (!quickWindow)
1051 return;
1052
1053 m_titleBar = new Titlebar(quickWindow->contentItem());
1054 m_titleBar->setZ(999999);
1055
1056 connect(m_titleBar, &Titlebar::closeClicked, this, [this]() {
1057 if (m_window)
1058 m_window->close();
1059 });
1060 connect(m_titleBar, &Titlebar::minimizeClicked, this, [this]() {
1061 if (m_window)
1062 m_window->showMinimized();
1063 });
1064 connect(m_titleBar, &Titlebar::maximizeClicked, this, [this]() {
1065 if (!m_window)
1066 return;
1067
1068 if (m_window->windowStates() & Qt::WindowMaximized)
1069 m_window->showNormal();
1070 else
1071 m_window->showMaximized();
1072 });
1073
1074 connect(m_window, &QWindow::activeChanged, this, [this]() {
1075 if (m_window && m_titleBar)
1076 m_titleBar->setWindowActive(m_window->isActive());
1077 });
1078
1079 m_titleBar->setTitle(m_window->title());
1080 connect(m_window, &QWindow::windowTitleChanged, m_titleBar, &Titlebar::setTitle);
1081 connect(quickWindow, &QQuickWindow::widthChanged, this, &Window::updateTitleBarGeometry);
1082 updateTitleBarGeometry();
1083}
1084
1085/**
1086 * @brief Updates the window minimum size to account for CSD decorations.

Callers

nothing calls this directly

Calls 6

setWindowActiveMethod · 0.80
titleMethod · 0.80
dataMethod · 0.45
closeMethod · 0.45
isActiveMethod · 0.45
setTitleMethod · 0.45

Tested by

no test coverage detected