From 4c1ad7056af8f47d634fa6cd7293952e00898e3d Mon Sep 17 00:00:00 2001 From: luzh Date: Sun, 29 Sep 2024 12:03:32 +0800 Subject: [PATCH] [fix] size overflow when meet large number of rows, so adjust section size dynamically. --- ui/zenoedit/panel/zenospreadsheet.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ui/zenoedit/panel/zenospreadsheet.cpp b/ui/zenoedit/panel/zenospreadsheet.cpp index 4736327163..0b90e357bd 100644 --- a/ui/zenoedit/panel/zenospreadsheet.cpp +++ b/ui/zenoedit/panel/zenospreadsheet.cpp @@ -277,6 +277,21 @@ void ZenoSpreadsheet::setPrim(std::string primid) { .arg(num_attrs) .arg(num_uvs); pStatusBar->setText(statusInfo); + + //如果条目数过多(比如几千万级别),会导致qheaderview内部计算视图高度时溢出(整型数上限) + //这时候要缩小section size. + int adjust_sec_size = 42; + if (num_vert > 10000000) { + int maxVSize = 2000000000; + int secsz = maxVSize / num_vert; + if (secsz > 0) { + adjust_sec_size = secsz; + } + } + + prim_attr_view->verticalHeader()->setMinimumSectionSize(adjust_sec_size); + prim_attr_view->verticalHeader()->setDefaultSectionSize(adjust_sec_size); + this->dataModel->setModelData(obj); } }