Compare commits

..

2 Commits

Author SHA1 Message Date
3bb8f8000b modify windows cation 2025-11-12 21:23:02 +08:00
d7ed79a4b4 modify sim scale 2025-11-12 21:10:37 +08:00
3 changed files with 20 additions and 15 deletions

2
.gitignore vendored
View File

@ -5,5 +5,7 @@ thirdparty/
tritoin/
CMakeFiles/
logs/
doc/data/
doc/images/
QWEN.md
CMakeCache.txt

View File

@ -27,7 +27,8 @@ namespace Gdiplus
#pragma comment (lib,"Dwmapi.lib") // Adds missing library, fixes error LNK2019: unresolved external symbol __imp__DwmExtendFrameIntoClientArea
#pragma comment (lib,"user32.lib")
constexpr unsigned long BorderlessFlag = WS_POPUP | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX;
// 无边框样式:不使用 CAPTION 与系统按钮,避免在 Win7 显示原生按钮
constexpr unsigned long BorderlessFlag = WS_POPUP | WS_THICKFRAME | WS_SYSMENU;
inline bool IsCompositionEnabled() {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@ -102,8 +103,11 @@ bool FramelessDelegateWin::nativeEvent(const QByteArray & eventType, void* messa
return true;
}
NCCALCSIZE_PARAMS* ncParam = reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
// 最大化时将客户区严格对齐到工作区,避免左右空隙
ncParam->rgrc[0].left = rc->left();
ncParam->rgrc[0].top = rc->top();
ncParam->rgrc[0].bottom = rc->bottom() + 1;
ncParam->rgrc[0].right = rc->right();
ncParam->rgrc[0].bottom = rc->bottom();
*result = 0;
return true;
} else {
@ -165,15 +169,13 @@ bool FramelessDelegateWin::nativeEvent(const QByteArray & eventType, void* messa
AdjustWindowRectEx(&frame, WS_OVERLAPPEDWINDOW, FALSE, 0);
double dpr = mainWidget_->devicePixelRatioF();
frames_.setLeft(abs(frame.left) / dpr + 0.5);
frames_.setTop(abs(frame.bottom) / dpr + 0.5);
frames_.setRight(abs(frame.right) / dpr + 0.5);
frames_.setBottom(abs(frame.bottom) / dpr + 0.5);
// 最大化时不叠加系统边框内边距,避免左右出现可见空隙
frames_.setLeft(0);
frames_.setTop(0);
frames_.setRight(0);
frames_.setBottom(0);
mainWidget_->setContentsMargins(frames_.left() + margins_.left(), \
frames_.top() + margins_.top(), \
frames_.right() + margins_.right(), \
frames_.bottom() + margins_.bottom());
mainWidget_->setContentsMargins(margins_);
justMaximized_ = true;
} else {
if (justMaximized_) {
@ -361,6 +363,11 @@ void FramelessDelegateWin::SetNativeWindowLong() {
// 避免父窗口与子窗口重叠绘制导致闪烁,启用剪裁样式
style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
// 显式清理可能由 Qt 或系统设置的标题栏与系统按钮标志,确保不显示原生按钮
style &= ~WS_CAPTION;
style &= ~WS_MINIMIZEBOX;
style &= ~WS_MAXIMIZEBOX;
if (!mainWidget_->windowFlags().testFlag(Qt::WindowMinimizeButtonHint) ||
mainWidget_->maximumSize() != QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)) {
style &= ~WS_MINIMIZEBOX;

View File

@ -95,11 +95,7 @@ void Timestep::Start() {
return;
}
workSpace_->Begin();
// 重置速度为 1x 并通知 UI
auto it = std::find(speedLevels_.begin(), speedLevels_.end(), 1.0);
speedIndex_ = it != speedLevels_.end() ? int(std::distance(speedLevels_.begin(), it)) : speedIndex_;
currentStep_ = speedLevels_[speedIndex_];
emit StepChanged(currentStep_);
// 保持当前倍速,不在开始时重置为 1x
emit StatusChanged((int)playStatus_);
}