75 lines
3.2 KiB
C++
75 lines
3.2 KiB
C++
#include "ResultListLayoutHelper.h"
|
|
#include <QListView>
|
|
|
|
// 统一的结果卡片网格尺寸
|
|
static const QSize kResultGridSize(178, 182);
|
|
|
|
void ResultListLayoutHelper::setupSingleCameraMode(QListWidget* resultList,
|
|
QWidget* detectImage, QWidget* detectImage2,
|
|
QWidget* frameDev, QWidget* detectLog,
|
|
int availableHeight)
|
|
{
|
|
// 检测图像: 占据左侧大部分空间,动态计算高度
|
|
int detectImageTop = 140;
|
|
int detectImageHeight = availableHeight - detectImageTop;
|
|
detectImage->setGeometry(20, detectImageTop, 1311, detectImageHeight);
|
|
|
|
// 第二检测图像: 隐藏
|
|
detectImage2->setVisible(false);
|
|
|
|
int rightStart = 1344;
|
|
// 设备状态框架: 位于右上方
|
|
frameDev->setGeometry(rightStart, detectImageTop, 556, 64);
|
|
|
|
// 检测结果列表: 位于右侧中间
|
|
resultList->setGeometry(rightStart, detectImageTop + 64 + 10, 556, 622);
|
|
|
|
// 结果列表流向配置
|
|
resultList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
|
resultList->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
resultList->setFlow(QListView::LeftToRight);
|
|
resultList->setWrapping(true);
|
|
resultList->setGridSize(kResultGridSize);
|
|
|
|
// 日志: 位于右下方,动态计算高度
|
|
int detectLogTop = detectImageTop + 64 + 10 + 622 + 10;
|
|
int detectLogHeight = availableHeight - detectLogTop;
|
|
detectLog->setGeometry(rightStart, detectLogTop, 556, detectLogHeight);
|
|
}
|
|
|
|
void ResultListLayoutHelper::setupMultiCameraMode(QListWidget* resultList,
|
|
QWidget* detectImage, QWidget* detectImage2,
|
|
QWidget* frameDev, QWidget* detectLog,
|
|
int availableHeight)
|
|
{
|
|
// 检测图像: 缩小到左侧一半空间,动态计算高度
|
|
int detectImageTop = 130;
|
|
int detectListHeight = 200;
|
|
|
|
int margeVal = 10;
|
|
int detectImageWidth = (1920 - 3 * margeVal) / 2;
|
|
|
|
int detectImageHeight = availableHeight - detectImageTop - detectListHeight - margeVal;
|
|
detectImage->setGeometry(margeVal, detectImageTop, detectImageWidth, detectImageHeight);
|
|
|
|
// 第二检测图像: 显示在右侧一半空间
|
|
detectImage2->setVisible(true);
|
|
detectImage2->setGeometry(margeVal * 2 + detectImageWidth, detectImageTop, detectImageWidth, detectImageHeight);
|
|
|
|
// 设备状态框架: 移动到下方左侧
|
|
frameDev->setGeometry(margeVal, availableHeight - detectListHeight, 180, detectListHeight);
|
|
|
|
// 检测结果列表: 移动到下方中间
|
|
resultList->setGeometry(margeVal + 180 + margeVal, availableHeight - detectListHeight, 1380, detectListHeight);
|
|
|
|
// 结果列表流向配置
|
|
resultList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
resultList->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
|
resultList->setFlow(QListView::LeftToRight);
|
|
resultList->setWrapping(false);
|
|
resultList->setGridSize(kResultGridSize);
|
|
|
|
// 日志: 移动到下方右侧
|
|
detectLog->setGeometry(margeVal * 3 + 180 + 1380, availableHeight - detectListHeight, 320, detectListHeight);
|
|
}
|