Sine Striker
2023-12-11 c3c6647e7888b7dbe9d9d22fb77bf08104a3653c
examples/mainwindow/mainwindow.cpp
@@ -53,42 +53,19 @@
        return menuBar;
    }();
    static const auto buttonStyleSheet = QLatin1String{ R"(
QPushButton {
    background-color:white;
    color:black;
}
QPushButton:hover {
    background-color:black;
    color:white;
}
QPushButton:pressed {
    background-color:red;
    color:white;
}
)" };
    auto iconButton = new QPushButton("I");
    iconButton->setFlat(true);
    iconButton->setAttribute(Qt::WA_Hover);
    iconButton->setMouseTracking(true);
    iconButton->setStyleSheet(buttonStyleSheet);
    auto minButton = new QPushButton("—");
    minButton->setFlat(true);
    minButton->setAttribute(Qt::WA_Hover);
    minButton->setMouseTracking(true);
    minButton->setStyleSheet(buttonStyleSheet);
    auto maxButton = new QPushButton("🗖");
    maxButton->setCheckable(true);
    maxButton->setFlat(true);
    maxButton->setAttribute(Qt::WA_Hover);
    maxButton->setMouseTracking(true);
    maxButton->setStyleSheet(buttonStyleSheet);
    auto closeButton = new QPushButton("✖");
    closeButton->setFlat(true);
    closeButton->setAttribute(Qt::WA_Hover);
    closeButton->setMouseTracking(true);
    closeButton->setStyleSheet(buttonStyleSheet);
    auto windowBar = new QWK::WindowBar();
    windowBar->setIconButton(iconButton);
@@ -100,10 +77,10 @@
    windowBar->setHostWidget(this);
    agent->setTitleBar(windowBar);
    agent->setSystemButton(QWK::CoreWindowAgent::WindowIcon, iconButton);
    agent->setSystemButton(QWK::CoreWindowAgent::Minimize, minButton);
    agent->setSystemButton(QWK::CoreWindowAgent::Maximize, maxButton);
    agent->setSystemButton(QWK::CoreWindowAgent::Close, closeButton);
    agent->setSystemButton(QWK::WindowAgentBase::WindowIcon, iconButton);
    agent->setSystemButton(QWK::WindowAgentBase::Minimize, minButton);
    agent->setSystemButton(QWK::WindowAgentBase::Maximize, maxButton);
    agent->setSystemButton(QWK::WindowAgentBase::Close, closeButton);
    agent->setHitTestVisible(menuBar, true);
    connect(windowBar, &QWK::WindowBar::minimizeRequested, this, &QWidget::showMinimized);
@@ -122,5 +99,6 @@
    setMenuWidget(windowBar);
    setCentralWidget(clockWidget);
    setWindowTitle("Example MainWindow");
    // setContentsMargins({0, 1, 0, 0});
    resize(640, 480);
}