Yuhang Zhao
2023-12-06 05fedeedb28df769ce16efea39be1cc5e2916b98
examples/mainwindow/mainwindow.cpp
@@ -32,8 +32,7 @@
void MainWindow::installWindowAgent() {
    auto agent = new QWK::WidgetWindowAgent(this);
    if (!agent->setup(this)) {
        qDebug() << "Frameless handle failed to initialize.";
        return;
        qFatal("Frameless handle failed to initialize.");
    }
    auto titleLabel = new QLabel();
@@ -54,11 +53,42 @@
        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);
@@ -92,5 +122,5 @@
    setMenuWidget(windowBar);
    setCentralWidget(clockWidget);
    setWindowTitle("Example MainWindow");
    resize(1024, 768);
    resize(640, 480);
}