fix(vtk): 抽屉折叠按钮 ◀▶ 文字改 SVG chevron 图标(根因:YaHei缺三角符→DirectWrite字体回退崩);回退GDI临时方案
This commit is contained in:
parent
5fe1c298d2
commit
5d1cf07882
|
|
@ -69,6 +69,10 @@ QString svgPathFor(Glyph t)
|
|||
return QStringLiteral(
|
||||
"<path d='M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3"
|
||||
"M21 16v3a2 2 0 0 1-2 2h-3M8 21H5a2 2 0 0 1-2-2v-3'/>");
|
||||
case Glyph::ChevronLeft:
|
||||
return QStringLiteral("<path d='m15 18-6-6 6-6'/>");
|
||||
case Glyph::ChevronRight:
|
||||
return QStringLiteral("<path d='m9 18 6-6-6-6'/>");
|
||||
case Glyph::Workspace:
|
||||
return QStringLiteral(
|
||||
"<rect width='7' height='7' x='3' y='3' rx='1'/>"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ enum class Glyph {
|
|||
Download, // 导出/下载
|
||||
Collapse, // 折叠(双箭头)
|
||||
Fullscreen, // 全屏 / 最大化
|
||||
ChevronLeft, // 折叠抽屉(向左)
|
||||
ChevronRight, // 展开抽屉(向右)
|
||||
// 顶部应用栏图标
|
||||
Workspace, // 工作空间(2x2 宫格)
|
||||
Folder, // 项目(文件夹)
|
||||
|
|
|
|||
|
|
@ -1251,14 +1251,6 @@ public:
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// Qt6 Windows 的 DirectWrite 字体数据库在本机枚举字体回退(fallbacksForFamily →
|
||||
// populateFamily)时崩溃(0xc0000005,见 logs/crash_*.dmp + geopro_*.log 栈):渲染后一次布局
|
||||
// 重算 QPushButton sizeHint → 对按钮文字整形 → 主字体(YaHei)缺某字形(如三角符 ◀▶)触发回退 →
|
||||
// DirectWrite 在本机抛 C++ 异常并最终段错误(登录/面板只用中文+拉丁,YaHei 都有,故先前不崩)。
|
||||
// 改用 GDI 字体引擎绕开有问题的 DirectWrite 回退路径(稳定优先,渲染质量略变)。须在 QApplication 前设置。
|
||||
qputenv("QT_QPA_PLATFORM", "windows:fontengine=gdi");
|
||||
#endif
|
||||
// Qt WebEngine(地图页签的 QWebEngineView):必须在 QApplication 构造前初始化,
|
||||
// 且需启用跨上下文共享 OpenGL(QtWebEngine 与 QVTK 同进程共用 GL context,避免黑屏/崩溃)。
|
||||
// AA_ShareOpenGLContexts 须在 QApplication 之前设置;QtWebEngineQuick::initialize() 同样须前置。
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "panels/columns/Column3DDataset.hpp"
|
||||
#include "panels/columns/Column2DDataset.hpp"
|
||||
#include "panels/columns/Column3DAnalysis.hpp"
|
||||
#include "Glyphs.hpp"
|
||||
#include "Theme.hpp"
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
|
@ -24,8 +25,12 @@ ColumnDrawer::ColumnDrawer(QWidget* parent)
|
|||
tabs->addTab(col2D_, QStringLiteral("二维数据集"));
|
||||
tabs->addTab(colAnalysis_, QStringLiteral("三维分析"));
|
||||
|
||||
// 折叠按钮:固定宽 18px,垂直拉伸
|
||||
toggleBtn_ = new QPushButton(QStringLiteral("◀"), this);
|
||||
// 折叠按钮:固定宽 18px,垂直拉伸。
|
||||
// 用 SVG 图标(makeGlyph)而非 ◀/▶ 文字——三角符(U+25C0/25B6)不在 YaHei,作按钮文字会触发
|
||||
// Qt 字体回退,本机 DirectWrite 在回退枚举时崩(0xc0000005)。SVG 图标走 QIcon 不做字体整形,规避之。
|
||||
toggleBtn_ = new QPushButton(this);
|
||||
toggleBtn_->setIcon(geopro::app::makeGlyph(Glyph::ChevronLeft,
|
||||
geopro::app::tokenColor("text/secondary"), 14));
|
||||
toggleBtn_->setFixedWidth(18);
|
||||
toggleBtn_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
toggleBtn_->setCursor(Qt::PointingHandCursor);
|
||||
|
|
@ -51,7 +56,8 @@ void ColumnDrawer::toggleCollapsed()
|
|||
{
|
||||
collapsed_ = !collapsed_;
|
||||
body_->setVisible(!collapsed_);
|
||||
toggleBtn_->setText(collapsed_ ? QStringLiteral("▶") : QStringLiteral("◀"));
|
||||
toggleBtn_->setIcon(geopro::app::makeGlyph(collapsed_ ? Glyph::ChevronRight : Glyph::ChevronLeft,
|
||||
geopro::app::tokenColor("text/secondary"), 14));
|
||||
// 折叠后只保留按钮宽度;展开恢复上限
|
||||
setMaximumWidth(collapsed_ ? 18 : 318);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue