修正采集设置对话框输入面板被压缩重叠

对话框把输入面板最大高度限制为 320,低于各行所需的自然高度,Finger 视频与传感器配置两行重叠。改为只限制预览图高度,并新增布局测试;已在 Windows 上目视确认。
This commit is contained in:
ykcheungab
2026-10-19 09:42:41 +08:00
parent a0c13c1dc6
commit bc5dfc035d
2 changed files with 32 additions and 4 deletions
@@ -65,6 +65,10 @@ DEFAULT_MBIT_PER_S = 10.0
#: itself. It only shapes the size estimate, never a recorded window. #: itself. It only shapes the size estimate, never a recorded window.
STEP_OVERHEAD_S = 5.0 STEP_OVERHEAD_S = 5.0
#: Qt's "no limit" for a widget's height, and the tallest preview this dialog shows.
_UNBOUNDED = 16777215
_PREVIEW_MAX_HEIGHT = 200
#: One probe per process. The probe writes three real clips, and every window in #: One probe per process. The probe writes three real clips, and every window in
#: this app would otherwise repeat it; the answer cannot change while the process #: this app would otherwise repeat it; the answer cannot change while the process
#: runs because it is a property of this machine's OpenCV build. #: runs because it is a property of this machine's OpenCV build.
@@ -130,11 +134,14 @@ class CaptureSettingsDialog(QDialog):
self.input_group = QGroupBox(page) self.input_group = QGroupBox(page)
self.input_group.setObjectName("groupBox") self.input_group.setObjectName("groupBox")
input_layout = QVBoxLayout(self.input_group) input_layout = QVBoxLayout(self.input_group)
# The input panel is the live image plus its controls. It stays bounded # The input panel is the live image plus its controls. The preview is what
# here: the dialog has four sections, and a preview that expands would push # is bounded here: the dialog has four sections, and a preview that expands
# the bundle, session and recording settings below the fold on every screen. # would push the bundle, session and recording settings below the fold. The
source_panel.setMaximumHeight(320) # panel itself is never capped. Its field rows, buttons and hints need
# their natural height, and a cap below that squeezes them into each other.
source_panel.setMaximumHeight(_UNBOUNDED)
source_panel.preview.setMinimumSize(140, 90) source_panel.preview.setMinimumSize(140, 90)
source_panel.preview.setMaximumHeight(_PREVIEW_MAX_HEIGHT)
input_layout.addWidget(source_panel) input_layout.addWidget(source_panel)
self.input_group.setSizePolicy( self.input_group.setSizePolicy(
QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Maximum QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Maximum
+21
View File
@@ -734,3 +734,24 @@ def test_a_stored_unavailable_codec_does_not_become_the_selection(make_window):
assert settings.codec.currentData() == "mp4v" assert settings.codec.currentData() == "mp4v"
assert settings.recording_options().codec == "mp4v" assert settings.recording_options().codec == "mp4v"
window.close() window.close()
def test_the_settings_dialog_does_not_squeeze_the_input_rows(make_window, qt_app):
"""The input panel keeps its natural height: no row may overlap the next one."""
window = make_window()
page = window.calibration_panel
dialog = page.settings
dialog.resize(720, 700)
dialog.show()
for _ in range(5):
qt_app.processEvents()
panel = window.finger_source_panel
assert panel.height() >= panel.minimumSizeHint().height()
video = panel.video_path.geometry()
config = panel.config_ref.geometry()
assert video.bottom() < config.top(), (video, config)
# The preview stays bounded, so the sections below remain reachable.
assert panel.preview.height() <= 200
dialog.close()
window.close()