Fix clipped combo boxes and preserve native popup layouts

This commit is contained in:
AttilaNet
2026-11-08 10:06:23 +08:00
parent 9611a3413f
commit 10610e7b6e
6 changed files with 191 additions and 12 deletions
+4 -3
View File
@@ -3,7 +3,7 @@ from PySide6 import QtCore as C, QtWidgets as W
from .daily import DailyPolicy, entries
from .maps import stages
from .native_widgets import IntegerInput, RowBatch
from .native_widgets import ComboBox, IntegerInput, RowBatch
from .presentation import map_source
from .sweeping import SweepPolicy
@@ -36,7 +36,7 @@ class ActivityPages:
line = W.QHBoxLayout()
self.map_enabled = W.QCheckBox("启用勾选关卡的自动扫荡")
self.map_keep_ti = number(0)
self.map_team = W.QComboBox()
self.map_team = ComboBox()
for name in ("teamA", "teamB", "teamC"):
self.map_team.addItem(name, name)
line.addWidget(self.map_enabled)
@@ -160,7 +160,7 @@ class ActivityPages:
if item is None:
item = W.QTreeWidgetItem(city)
item.setData(0, C.Qt.ItemDataRole.UserRole, key)
difficulty = W.QComboBox()
difficulty = ComboBox()
difficulty.currentIndexChanged.connect(lambda index, key=key, widget=difficulty: self.map_rule_changed(key, level=widget.currentData()))
limit = number(rule.get("limit", 3), 999)
limit.valueChanged.connect(lambda value, key=key: self.map_rule_changed(key, limit=value))
@@ -188,6 +188,7 @@ class ActivityPages:
for i, stage in enumerate(options):
difficulty.model().item(i).setEnabled(stage.unlocked and stage.open)
difficulty.setCurrentIndex(difficulty.findData(chosen.level))
self.maps_tree.setColumnWidth(3, max(self.maps_tree.columnWidth(3), difficulty.minimumSizeHint().width()))
limit = self.maps_tree.itemWidget(item, 8)
block_limit = C.QSignalBlocker(limit)
if not limit.hasFocus():