v3.0.1:修复了一些已知BUG,增强了TextBox

This commit is contained in:
2026-03-17 20:19:05 +08:00
parent c66cad3423
commit b765e54eff
5 changed files with 317 additions and 40 deletions
+45
View File
@@ -7,6 +7,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[中文文档](CHANGELOG.md) [中文文档](CHANGELOG.md)
## [v3.0.1] - 2026 - 03 - 17
==Notice==
This update changes the **semantics of `TextBox::setText`**.
If your old code manually called `draw()` after calling `setText()`, you should now remove that call. Otherwise, under the new version, old code may cause `TextBox` to flicker in some cases.
### 🙏 Acknowledgements
Special thanks to [Pengfei Zhu](https://github.com/zhupengfeivip) for helping improve the StellarX documentation, especially the **Include Directories and Library Directories Configuration** section, and for reporting the issue where passing `NULL` in window mode would cause a console window to pop up ([Issues#9](https://github.com/Ysm-04/StellarX/issues/9)).
### ⚙️ Changes
- **Changed semantics of `TextBox::setText`:**
The old dirty-mark-only behavior has been replaced with a more robust workflow.
- If the text has not changed, the function returns immediately without doing anything.
- If the text has changed, it will decide whether to redraw immediately or request an upstream redraw depending on whether the graphics context/window has already been created. If the graphics context/window has not yet been created, it will only mark itself as dirty.
- **TextBox - text overflow truncation:**
If the user types text or calls `setText()` to set text, and the text length does not exceed `maxCharLen` but its pixel width exceeds the `TextBox` width, the displayed text will be truncated by character and appended with `...` for rendering.
The full original text is still stored internally and is not affected when retrieved through getter methods.
### ✅ Fixes
- **`TabControl::getActiveIndex() const` could return the last tab index when the tab list was not empty but no tab was active:**
Fixed the issue where calling `getActiveIndex()` could sometimes return an incorrect index.
Now:
- if the tab list is empty, it returns `-1`
- if no tab is active, it returns `-1`
- if a tab is active, it returns the index of the active tab
- **Continuous full redraw while a dialog is open:**
Added a new variable `dialogOpen` to `Window`.
When a dialog is shown, `dialogOpen` is set to `true`. Only when `dialogOpen` is `true` will `needRedraw` be checked. After redrawing, `dialogOpen` is immediately reset to `false`.
- **Synthetic `WM_MOUSEMOVE` being dispatched when a dialog opens, instead of only when it closes:**
Added a condition when dispatching synthetic `WM_MOUSEMOVE`.
Now it is only synthesized and dispatched when `dialogClose` is `true`, meaning only after a dialog is closed.
- **Normal control event dispatch order in `Window::runEventLoop`:**
Changed the traversal of `controls (vector)` from forward order
`for (auto& c : controls)`
to reverse order
`for (auto it = controls.rbegin(); it != controls.rend(); ++it)`
## [v3.0.0] - 2026-01-09 ## [v3.0.0] - 2026-01-09
### ✨ New Features ### ✨ New Features
+24
View File
@@ -7,6 +7,30 @@ StellarX 项目所有显著的变化都将被记录在这个文件中。
[English document](CHANGELOG.en.md) [English document](CHANGELOG.en.md)
## [v3.0.1] - 2026 - 03 - 17
==注意==
此次更新变更了**TextBox::setText语义**之前如果再调用`setText`之后手动调用了`draw`方法现在应当删除,否则旧代码在新版本可能会造成`TextBox`闪烁(概率触发)【配置包含目录与库目录】
### 🙏 鸣谢
感谢用户[Pengfei Zhu](https://github.com/zhupengfeivip)帮StellarX完善文档【配置包含目录与库目录】部分,以及反馈在窗口模式传递参数NULL时会弹出命令行窗口的问题[Issues#9](https://github.com/Ysm-04/StellarX/issues/9)
### ⚙️ 变更
- **TextBox::setText语义变化:**由原来的仅标脏改为更健全的工作原理
- 如果文本未发生变化则立即return不做任何操作
- 如果文本变化则根据是否已经创建图形上下文/窗口决定是否立即重绘/向上请求,如果图形上下文/窗口还为创建则仅标记为脏
- **TextBox-文本溢出截断:**如果用户输入或者调用`setText`设置文本,文本不超过`maxCharLen`但是像素长度超过`TextBox`则按字符截断并添加...绘制,内部仍然保存完整的文本不影响get方法获取
### ✅ 修复
- **TabControl::getActiveIndex() const当页签对列表不为空时,如果所有页签都未激活则会返回最后一个页签的索引:**修复再调用`getActiveIndex()`概率获取错误的索引,如果页签对列表为空或者没有页签激活则返回-1,如果有页签激活则返回对应页签索引
- **对话框打开时持续持续触发全量重绘:**Window新增变量`dialogOpen`,在对话框弹出时设置`dialogOpen``true`,只有dialogOpen为真时才判断`needredraw`,在重绘后立即设置`dialogOpen``flase`
- **对话框关闭合成WM_MOUSEMOVE下发更新 可见控件hover 状态,在对话框打开时也会触发:**合成`WM_MOUSEMOVE`下发时判断是否有对话框关闭,只有`dialogClose`为真才合成并下发`WM_MOUSEMOVE`
- **Window::runEventLoop普通控件事件分发顺序:**将`controls(vector)`的正序遍历`for (auto& c : controls)`改为逆序遍历`for (auto it = controls.rbegin(); it != controls.rend(); ++it)`
## [v3.0.0] - 2026 - 01 - 09 ## [v3.0.0] - 2026 - 01 - 09
### ✨ 新增 ### ✨ 新增
+18 -20
View File
@@ -2,6 +2,11 @@
[中文README](README.md) [中文README](README.md)
official website:https://stellarx-gui.top
blog: https://blog.stellarx-gui.top
> For framework information and quick start instructions, please visit the official website. For detailed usage tutorials, please refer to the StellarX Xingyuan page on my personal blog.
------ ------
![GitHub all releases](https://img.shields.io/github/downloads/Ysm-04/StellarX/total) ![GitHub all releases](https://img.shields.io/github/downloads/Ysm-04/StellarX/total)
@@ -25,34 +30,27 @@ This is a **teaching-grade and tooling-grade** framework that helps developers u
------ ------
### 🆕V3.0.0 - Major Update ### 🆕V3.0.1 - Major Update
[CHANGELOG.en.md](CHANGELOG.en.md) [CHANGELOG.en.md](CHANGELOG.en.md)
### ✨ New Features ==Notice==
- **SxLog**: A lightweight logging system with support for log levels, tag filtering, bilingual (Chinese/English) output, and console/file logging with optional file rolling. This update changes the **semantics of `TextBox::setText`**.
- **TabControl**: Improved tab switching logic to ensure the current tab is closed before the target tab is opened. If your previous code manually called `draw()` after calling `setText()`, that call should now be removed. Otherwise, under the new version, old code may cause `TextBox` flickering in some cases.
- **Improved Setters**: Setters now only update state and mark as dirty, with drawing handled by the unified redraw flow.
### 🙏 Acknowledgements
Special thanks to [Pengfei Zhu](https://github.com/zhupengfeivip) for helping improve the StellarX documentation, especially the **Include Directories and Library Directories Configuration** section, and for reporting the issue where passing `NULL` in window mode would cause a console window to appear ([Issues#9](https://github.com/Ysm-04/StellarX/issues/9)).
### ⚙️ Changes ### ⚙️ Changes
- **TabControl Default Active Tab**: Default active tab logic clarified. First, set the active index without immediate drawing; after the first draw, the tab is activated. - **Changed semantics of `TextBox::setText`:** from the previous dirty-mark-only behavior to a more robust workflow
- If the text has not changed, it returns immediately without doing anything.
- If the text has changed, it decides whether to redraw immediately or request an upstream redraw depending on whether the graphics context/window has already been created. If the graphics context/window has not yet been created, it only marks itself as dirty.
- **TextBox - text overflow truncation:** when the user enters text or calls `setText` to set text, if the text length does not exceed `maxCharLen` but its pixel width exceeds the `TextBox` width, the displayed text will be truncated by character and appended with `...` when rendered. The full original text is still stored internally and is not affected when retrieved through getter methods.
### ✅ Fixes **For other fixes and changes, please refer to the [Changelog](CHANGELOG.md).**
- **TabControl::setActiveIndex Crash**: Fixed crash when setting the default active tab before the first draw.
- **TabControl Rendering Glitch**: Fixed issue where non-active tabs were incorrectly drawn when switching visibility.
### ⚠️ Breaking Changes
- **Button Size APIs Removed**: `getButtonWidth()` and `getButtonHeight()` removed; use `getWidth()` and `getHeight()` instead.
- **No Immediate Drawing for Setters**: Setters like `setText()` no longer trigger immediate drawing.
### 📌 Upgrade Guide
- **Button**: Replace `getButtonWidth()` / `getButtonHeight()` with `getWidth()` / `getHeight()`.
- **Setters**: Ensure a redraw mechanism after calling setters like `setText()`.
## 📦 Project Structure & Design Philosophy ## 📦 Project Structure & Design Philosophy
+15 -20
View File
@@ -3,6 +3,9 @@
[English document](README.en.md) [English document](README.en.md)
官网地址:https://stellarx-gui.top 官网地址:https://stellarx-gui.top
博客:https://blog.stellarx-gui.top
> 框架信息以及快速开始可前往官网查看,详细的使用教程可前往个人博客的StellarX星垣页面查看
> 本仓库为 **StellarX** 主仓:开发与 Issue/PR 均在 GitHub 进行。 > 本仓库为 **StellarX** 主仓:开发与 Issue/PR 均在 GitHub 进行。
> GitCode 仅为只读镜像:如需反馈请到 GitHub:https://github.com/Ysm-04/StellarX > GitCode 仅为只读镜像:如需反馈请到 GitHub:https://github.com/Ysm-04/StellarX
@@ -34,34 +37,26 @@
### 🆕V3.0.0 - 重要更新 ### 🆕V3.0.1 - 重要更新
完整版建议查看[更新日志](CHANGELOG.md) 完整版建议查看[更新日志](CHANGELOG.md)
### ✨ 新增功能 ==注意==
- **SxLog**: 轻量级日志系统,支持日志级别、标签过滤、中英文输出及控制台/文件日志,支持文件滚动。 此次更新变更了**TextBox::setText语义**之前如果再调用`setText`之后手动调用了`draw`方法现在应当删除,否则旧代码在新版本可能会造成`TextBox`闪烁(概率触发)【配置包含目录与库目录】
- **TabControl**: 改进页签切换逻辑,确保先关闭当前页再打开目标页。
- **控件 Setter 改进**: Setter 仅更新状态并标记为脏,绘制由统一重绘流程处理。 ### 🙏 鸣谢
感谢用户[Pengfei Zhu](https://github.com/zhupengfeivip)帮StellarX完善文档【配置包含目录与库目录】部分,以及反馈在窗口模式传递参数NULL时会弹出命令行窗口的问题[Issues#9](https://github.com/Ysm-04/StellarX/issues/9)
### ⚙️ 变更 ### ⚙️ 变更
- **TabControl 默认激活页**: 默认激活页逻辑明确,首次设置激活索引后才绘制。 - **TextBox::setText语义变化:**由原来的仅标脏改为更健全的工作原理
- 如果文本未发生变化则立即return不做任何操作
- 如果文本变化则根据是否已经创建图形上下文/窗口决定是否立即重绘/向上请求,如果图形上下文/窗口还为创建则仅标记为脏
- **TextBox-文本溢出截断:**如果用户输入或者调用`setText`设置文本,文本不超过`maxCharLen`但是像素长度超过`TextBox`则按字符截断并添加...绘制,内部仍然保存完整的文本不影响get方法获取
### ✅ 修复 **其余修复及变更请前往[更新日志](CHANGELOG.md)**
- **TabControl::setActiveIndex 崩溃**: 修复首次绘制前设置默认激活页时崩溃的问题。
- **TabControl 渲染错乱**: 修复 `setIsVisible` 切换时,非激活页错误绘制导致的重叠问题。
### ⚠️ 破坏性更改
- **Button 尺寸 API 移除**: 移除了 `getButtonWidth()` / `getButtonHeight()`,请使用 `getWidth()` / `getHeight()`
- **Setter 不再即时绘制**: `setText()` 等 Setter 不再触发即时绘制。
### 📌 升级指南
- **Button**: 将 `getButtonWidth()` / `getButtonHeight()` 替换为 `getWidth()` / `getHeight()`
- **Setter**: 在调用 Setter 后确保触发重绘机制。
--- ---
+215
View File
@@ -0,0 +1,215 @@
commit c66cad3423a46ec4ef902965baa4c1816d10148a (HEAD -> master)
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Tue Mar 17 20:13:42 2026 +0800
修复了一些BUG,增强了一些功能,详情查看更新日志
commit 348cf666f5f1bc345858608a171d222540ad6e45 (origin/master)
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Sun Jan 11 16:14:42 2026 +0800
更新API文档,增加英文描述以及新增的API和SXLog日志模块
commit 572802e2ee9561c787309cc995c7804c5faf9c80
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Sun Jan 11 13:33:05 2026 +0800
更正:重新上传删除Button::getButtonWidth/Height接口
commit 10a91f9a6488c972cc93937d745f7ab2c97a8a42
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Fri Jan 9 22:29:33 2026 +0800
更新Cmake文件-支持外部依赖集成
commit eb96e5a64e74bbc8cd8333d09c4a995c3a112c5c
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Fri Jan 9 20:20:38 2026 +0800
feat: add a new awesome feature
commit 5cb59b36525cde93de83313551296c6458694110
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Fri Jan 9 20:17:47 2026 +0800
feat: add a new awesome feature
commit 0c1cf2938f0d6c5684eeb318f17a8443e0c8cf5a
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Sat Dec 20 17:29:03 2025 +0800
feat: add a new awesome feature
commit aa0fa8d3206eea3b31f2efba0c6532c45bd19c39
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Fri Dec 5 20:05:10 2025 +0800
feat: add a new awesome feature
commit 43564ef6759cd9b67f4f222266fd368276d1b3fb
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Thu Dec 4 14:25:56 2025 +0800
feat: add a new awesome feature
commit 53dc237e46b006b6d1fbf292611789089e932cdd
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Sun Nov 30 20:09:16 2025 +0800
feat: add a new awesome feature
commit 46febdb973206824d3382fa94fe6697c4c07ee2a
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Sun Nov 30 19:05:58 2025 +0800
feat: add a new awesome feature
commit f05962954f4a4efca42fe918a6bd5f97637bc2f3
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Thu Nov 20 01:59:53 2025 +0800
feat: add a new awesome feature
commit 58d4e8ab2f35a3dc98448c229a07518d303a48c4
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Wed Nov 19 15:14:39 2025 +0800
feat: add a new awesome feature
commit 5420bfd64465e074355c101a980dc1e08e86ddf2
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Sat Nov 8 01:06:37 2025 +0800
feat: add a new awesome feature
commit cc08187ceda2ddd3a3c0999ac6d09f9f8965c610
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Wed Nov 5 13:33:55 2025 +0800
feat: add a new awesome feature
commit c10e72b3feea31db2349654d94930acfcf3c6b04
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Tue Nov 4 21:27:57 2025 +0800
feat: add a new awesome feature
commit 6218ba54e332ee34c42aa1595aeed80db3b03343
Author: 霜霜 <ysm3150131407@gmail.com>
Date: Tue Nov 4 21:15:10 2025 +0800
Add GitHub Actions workflow to mirror to GitCode
commit 7b087e296a881d23a7c16782bcb59dc7c3fba56d
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Tue Nov 4 16:48:53 2025 +0800
feat: add a new awesome feature
commit 8dee285de8ee3d70b7d7cfd1a652846405e8b851
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Mon Nov 3 11:54:01 2025 +0800
feat: add a new awesome feature
commit d16b9bc226ae3fcd48096a18969dde993e2de268
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Mon Nov 3 11:35:35 2025 +0800
feat: add a new awesome feature
commit 270c6f5293880cd2e6f742a3b767ba98ad0a9655
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Mon Nov 3 11:29:09 2025 +0800
feat: add a new awesome feature
commit 4bb035208813c82fa29215aec2f3fc83da2e3a81
Author: Ysm-04 <ysm3150131407@gmail.com>
Date: Sun Nov 2 18:04:55 2025 +0800
feat: add a new awesome feature
commit c4852d080fa17b89fdfbcf9c7cdc69f532ec5d05
Author: Ysm-04 <3150131407@qq.com>
Date: Mon Oct 27 16:29:43 2025 +0800
feat: add a new awesome feature
commit dcf13895da2741c19e9bfb7d232656e9a7886df5
Author: Ysm-04 <3150131407@qq.com>
Date: Mon Oct 27 14:59:29 2025 +0800
feat: add a new awesome feature
commit 95149238e221b19a15bfa750bcf937620e23fd47
Author: Ysm-04 <3150131407@qq.com>
Date: Fri Oct 3 16:34:58 2025 +0800
feat: add a new awesome feature
commit 3509b2bc39c4df2af603d0f858385f8b132277b1
Author: Ysm-04 <3150131407@qq.com>
Date: Wed Oct 1 00:57:41 2025 +0800
feat: add a new awesome feature
commit 26f30cee39ee6bbcb09eb5e9f81b7cd8ab3b20fc
Author: Ysm-04 <3150131407@qq.com>
Date: Tue Sep 30 19:26:01 2025 +0800
feat: add a new awesome feature
commit 741987e48b1e62d91c295ee020815ed8ab448d32
Author: Ysm-04 <3150131407@qq.com>
Date: Mon Sep 22 20:39:34 2025 +0800
feat: add a new awesome feature
commit 9226deaf857e95093b71283887772f6b0ed7e643
Author: Ysm-04 <3150131407@qq.com>
Date: Mon Sep 22 16:51:14 2025 +0800
feat: add a new awesome feature
commit 9f2b175b17be5c383bae1e9f1b961e5c76c0ab48 (tag: v2.0.0)
Author: Ysm-04 <3150131407@qq.com>
Date: Mon Sep 22 15:08:49 2025 +0800
feat: add a new awesome feature
commit bd4588731b879ae34ef303804c4b918fcc6ff94c (tag: v1.0.0)
Author: Ysm-04 <3150131407@qq.com>
Date: Mon Sep 8 01:23:02 2025 +0800
feat: add a new awesome feature
commit 0522bffa1b6e259ab4d671786ca128a53bd6347b
Author: Ysm-04 <3150131407@qq.com>
Date: Sun Sep 7 22:26:23 2025 +0800
feat: add a new awesome feature
commit 49ecb65514108581799707ede5468a672b26fed1
Author: Ysm-04 <3150131407@qq.com>
Date: Sun Sep 7 10:35:39 2025 +0800
feat: add a new awesome feature
commit 0a9e290d42b7f98bc6a7324c68af466d406d97c6
Author: Ysm-04 <3150131407@qq.com>
Date: Sun Sep 7 00:25:30 2025 +0800
initial commit
commit a29b4371fbc541fef11f82dbc5721b471815036c
Author: Ysm-04 <3150131407@qq.com>
Date: Sun Sep 7 00:22:33 2025 +0800
initial commit
commit d62d8a90d6bec7ffdcdcc0583e6881da83e05255
Author: Ysm-04 <3150131407@qq.com>
Date: Sun Sep 7 00:19:40 2025 +0800
initial commit