fix(canvas): 空状态卡片用 canvas/bg 等色无缝底(原生GL覆盖透明失效的可靠解法)

This commit is contained in:
gaozheng 2026-06-10 16:08:31 +08:00
parent 8eb0c7413d
commit e60bdbc150
1 changed files with 5 additions and 4 deletions

View File

@ -397,10 +397,11 @@ void buildWorkbench(QMainWindow& window, geopro::data::LocalSampleRepository& re
auto* emptyState = new QFrame(centerWidget); auto* emptyState = new QFrame(centerWidget);
emptyState->setObjectName(QStringLiteral("centralEmpty")); emptyState->setObjectName(QStringLiteral("centralEmpty"));
emptyState->setAttribute(Qt::WA_TransparentForMouseEvents); emptyState->setAttribute(Qt::WA_TransparentForMouseEvents);
emptyState->setAttribute(Qt::WA_TranslucentBackground); // 透明浮于深色画布(不让控件填充不透明底) // 背景取 canvas/bg(#0B1320)——与画布同色:在原生 GL 上覆盖透明无法生效(会回退成不透明浅底),
emptyState->setStyleSheet(QStringLiteral( // 故用与画布等色的不透明底,卡片即「无缝隐形」,浅色提示字稳稳浮于深底(与左上视图详情浮层同法)。
"#centralEmpty { background: transparent; }" geopro::app::applyTokenizedStyleSheet(
"#centralEmpty QLabel { background: transparent; }")); emptyState, QStringLiteral("#centralEmpty { background: {{canvas/bg}}; }"
"#centralEmpty QLabel { background: transparent; }"));
auto* esLay = new QVBoxLayout(emptyState); auto* esLay = new QVBoxLayout(emptyState);
esLay->setContentsMargins(geopro::app::space::kXl, geopro::app::space::kXl, esLay->setContentsMargins(geopro::app::space::kXl, geopro::app::space::kXl,
geopro::app::space::kXl, geopro::app::space::kXl); geopro::app::space::kXl, geopro::app::space::kXl);