Repository navigation
perf+fix: UI/窗口性能优化系列 与 macOS 原生最大化修复 - #10
Merged
Merged
Conversation
Add elaMixColor helper in ElaDef.h for animated color interpolation. Animate hover fill for ElaPushButton, ElaToggleButton, ElaToolButton and window titlebar buttons (150ms/175ms fades, press stays instant).
Hover fill fades over 150ms (OutCubic); the check mark and radio dot pop in over 200ms (OutBack) with scale and opacity.
Body background now interpolates between base and hover colors over 150ms instead of switching instantly.
Track hovered row per index (or per hover row for tables) and fade the row highlight in and out over 150ms; selected rows blend between selected and selected-hover colors.
Tab and menu item hover overlays fade in and out over 150ms, keyed by item rect since one style instance serves many items.
- ElaSkeleton: pause shimmer animation on hideEvent, resume on showEvent, and skip valueChanged updates while not visible - ElaProgressRing: same pause/resume for the two busy animations, plus a visibility guard in the valueChanged handler - setIsBusying(false) semantics unchanged (stop + reset) No visual change: durations, easing and shimmer/busy rendering untouched.
Add a visibility guard to every animation valueChanged callback that marks its widget dirty (~56 sites across widgets, private impls, developer components and styles). State updates stay outside the guard so the final animation value is never lost; only the repaint is skipped. Style/delegate callbacks now check widgetGuard/owner view visibility as well. No visual change for visible widgets.
Buttons (IconButton/FloatButton/ToggleButton) and the style animation helpers now keep one long-lived animation object per purpose and only reset start/end values on re-entry, instead of allocating a new QPropertyAnimation/QVariantAnimation and re-connecting on every Enter/Leave/check/toggle. DeleteWhenStopped removed on the cached objects; in/out dual purposes use separate cached slots. Also covers the row/tab/menu hover helpers whose callbacks previously had no visibility guard: the cached connections now include the isVisible() check. ElaWindowStyle per-widget keyed animations intentionally left as is. No visual change: durations, easing and end states unchanged.
…r handle - List/Table/Tree view row hover fades now dirty a viewport row strip via viewport()->update(rect) (the same region Qt itself uses for its hover handling) instead of a full-widget update; the in/out strips are captured when the animation starts - Slider handle radius transitions (ElaSliderStyle, ElaColorValueSliderStyle) update only the handle rect expanded by 2px Visual behavior unchanged; row strip expansion (2px) covers the rounded highlight and antialiasing bleed.
…page switch QApplication::processEvents() inside the navigation path risks event re-entrancy (a re-entering navigation could restart animations or re-grab page pixmaps mid-flight). QTimer::singleShot(0) keeps the same ordering (one frame of the blurred state renders before the page switches) without re-entering the event loop.
The icon fade in ElaCopyButton and the expand-icon rotation in ElaTreeSelectPrivate used QPropertyAnimation(this, "") purely as a timer that drives repaints. Replace them with QVariantAnimation (same durations, easing and valueChanged handling) so no property lookup on an empty name happens per tick.
…rounds doExponentialBlur now scales the image down to 1/4 side length, blurs with a proportionally reduced radius, then smooth-scales back up. The exponential decay length relative to the image size is unchanged, so the visual result is nearly identical while the pixel work drops ~16x for the Mica/acrylic background (blurRadius 500 on window resize). Small images and small radii keep the original full-resolution path.
ElaToast, ElaFlyout, ElaSnackbar, ElaPopconfirm and ElaTeachingTip are frameless top-level Qt::Tool windows; animating setWindowOpacity gives the same fade without the offscreen render+composite that a graphics opacity effect adds on every frame. Durations, easing and fade in/out sequencing unchanged. The unused _opacityEffect members in the ElaFlyout/ElaPopconfirm private classes are removed. ElaPopularCardFloater keeps its effect (child-widget opacity, no window to animate).
ElaSplashScreen already animates windowOpacity directly; the effect header was never used in these three translation units.
On macOS, ElaAppBar applied Qt::FramelessWindowHint, which strips NSWindowStyleMaskTitled from the NSWindow. showMaximized() then degenerates into a plain geometry stretch filling the screen instead of a native zoom, losing restore geometry, fullscreen/split-view and Mission Control behaviors. Instead, keep the window titled and hide the title bar appearance via Cocoa APIs (titlebarAppearsTransparent, NSWindowTitleHidden, NSWindowStyleMaskFullSizeContentView, hide traffic-light buttons) so the system handles maximize/restore natively. Also sync the maximize button icon on macOS via QEvent::WindowStateChange (previously only synced on Windows through WM_SIZE). Fixes #9
QT_SDK_DIR / CMAKE_INSTALL_PREFIX may contain backslashes (e.g. D:\a\...\bin from install-qt-action). Interpolating them verbatim into install(CODE) writes invalid escape sequences into the generated cmake_install.cmake, failing 'cmake --install' with "Invalid character escape '\a'". Normalize WINDEPLOYQT_EXECUTABLE, QT_SDK_DIR and CMAKE_INSTALL_PREFIX with file(TO_CMAKE_PATH) before embedding them into the install script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
包含 perf/ui-animation 分支上的性能优化提交,以及本 PR 新增的 macOS 窗口行为修复。
重点:macOS 原生最大化修复(Fixes #9)
问题:macOS 上点击最大化按钮后窗口只是原地拉伸铺满屏幕,不是系统原生最大化。
根因:
ElaAppBar在非 Windows 平台给窗口强加了Qt::FramelessWindowHint,macOS 上这会移除 NSWindow 的Titledstyle mask,showMaximized()退化为 Qt 手动几何拉伸。修复:
private/ElaCocoaWindowHelper(.h/.mm):保留原生标题栏,通过 Cocoa API 实现无边框观感(titlebarAppearsTransparent+NSWindowTitleHidden+NSWindowStyleMaskFullSizeContentView+ 隐藏红绿灯按钮)ElaAppBarmacOS 分支不再设置Qt::FramelessWindowHint,在窗口 Show 事件中应用原生设置QEvent::WindowStateChange同步最大化/还原图标(原先仅 Windows 通过 WM_SIZE 同步)setIsFixedSize/ 置顶切换后重新应用原生设置,避免重建窗口后丢失已通过 clang -fsyntax-only 语法校验(遵循仓库约定未做本地完整构建),请以 CI 为准。