From 3781b8d6a5c8a82a8ffb97383ac5e4b5e8872b0b Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周三, 13 12月 2023 23:45:43 +0800
Subject: [PATCH] Add qwk config

---
 examples/mainwindow/mainwindow.cpp |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp
index ce3d742..c18fe5d 100644
--- a/examples/mainwindow/mainwindow.cpp
+++ b/examples/mainwindow/mainwindow.cpp
@@ -77,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);
@@ -95,9 +95,17 @@
 
     auto clockWidget = new ClockWidget();
     clockWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    connect(clockWidget, &QAbstractButton::clicked, this, [this]() {
+        if (!isMaximized()) {
+            showMaximized();
+        } else {
+            showNormal();
+        }
+    });
 
     setMenuWidget(windowBar);
     setCentralWidget(clockWidget);
     setWindowTitle("Example MainWindow");
+    // setContentsMargins({0, 1, 0, 0});
     resize(640, 480);
 }

--
Gitblit v1.9.1