Fix clipped combo boxes and preserve native popup layouts
This commit is contained in:
@@ -8,6 +8,9 @@
|
|||||||
隐藏期间仍继续记录日志,重新显示恢复上次高度;高度和显隐状态随账号/角色配置保存。
|
隐藏期间仍继续记录日志,重新显示恢复上次高度;高度和显隐状态随账号/角色配置保存。
|
||||||
孵蛋优先级、补货下限/目标和魔物喂养优先级均可直接输入数字,没有上下箭头。
|
孵蛋优先级、补货下限/目标和魔物喂养优先级均可直接输入数字,没有上下箭头。
|
||||||
横向、纵向滚动条均加宽为22个逻辑像素;仅调整滚动条,窗口与按钮保持原样。
|
横向、纵向滚动条均加宽为22个逻辑像素;仅调整滚动条,窗口与按钮保持原样。
|
||||||
|
下拉框默认加宽,表格中的操作、市场和难度列同步留足宽度;弹出列表按最长选项展开,并为滚动条预留宽度。
|
||||||
|
超过屏幕宽度的文字可横向滚动。
|
||||||
|
下拉框收起时悬停可查看完整选项,动态加载的区服、市场和魔物名称会重新计算宽度。
|
||||||
|
|
||||||
## 当前功能
|
## 当前功能
|
||||||
|
|
||||||
@@ -208,7 +211,7 @@
|
|||||||
- 自定义表:`typeId, sell_money, sell_exp, time_total`(秒),可只提供部分
|
- 自定义表:`typeId, sell_money, sell_exp, time_total`(秒),可只提供部分
|
||||||
覆盖列;中文列名“编号、派遣金币、强化经验、孵化秒数”也支持。
|
覆盖列;中文列名“编号、派遣金币、强化经验、孵化秒数”也支持。
|
||||||
- 测试:`python -m unittest discover -s ranch_assistant/tests -v`。
|
- 测试:`python -m unittest discover -s ranch_assistant/tests -v`。
|
||||||
- 127 项本地测试通过,覆盖登录、会话隔离、请求计数、成长同步、孵蛋与补货、批量喂养、派遣、赠礼、委托、扫荡和每日奖励。
|
- 131 项本地测试通过,覆盖登录、会话隔离、请求计数、成长同步、孵蛋与补货、批量喂养、派遣、赠礼、委托、扫荡和每日奖励。
|
||||||
新增牧场树形/平铺切换、分组数量与空位、刷新保留折叠和控件、4S保留条件、随机刷新间隔及到期独立同步的回归测试。
|
新增牧场树形/平铺切换、分组数量与空位、刷新保留折叠和控件、4S保留条件、随机刷新间隔及到期独立同步的回归测试。
|
||||||
双账号与大量库存的界面响应继续通过测试;测试使用本地模拟数据和模拟服务,不操作真实账号库存。
|
双账号与大量库存的界面响应继续通过测试;测试使用本地模拟数据和模拟服务,不操作真实账号库存。
|
||||||
- 网络写请求发生异常后不会直接重试,以免重复消耗魔物或物品。
|
- 网络写请求发生异常后不会直接重试,以免重复消耗魔物或物品。
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from PySide6 import QtCore as C, QtWidgets as W
|
|||||||
|
|
||||||
from .daily import DailyPolicy, entries
|
from .daily import DailyPolicy, entries
|
||||||
from .maps import stages
|
from .maps import stages
|
||||||
from .native_widgets import IntegerInput, RowBatch
|
from .native_widgets import ComboBox, IntegerInput, RowBatch
|
||||||
from .presentation import map_source
|
from .presentation import map_source
|
||||||
from .sweeping import SweepPolicy
|
from .sweeping import SweepPolicy
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ class ActivityPages:
|
|||||||
line = W.QHBoxLayout()
|
line = W.QHBoxLayout()
|
||||||
self.map_enabled = W.QCheckBox("启用勾选关卡的自动扫荡")
|
self.map_enabled = W.QCheckBox("启用勾选关卡的自动扫荡")
|
||||||
self.map_keep_ti = number(0)
|
self.map_keep_ti = number(0)
|
||||||
self.map_team = W.QComboBox()
|
self.map_team = ComboBox()
|
||||||
for name in ("teamA", "teamB", "teamC"):
|
for name in ("teamA", "teamB", "teamC"):
|
||||||
self.map_team.addItem(name, name)
|
self.map_team.addItem(name, name)
|
||||||
line.addWidget(self.map_enabled)
|
line.addWidget(self.map_enabled)
|
||||||
@@ -160,7 +160,7 @@ class ActivityPages:
|
|||||||
if item is None:
|
if item is None:
|
||||||
item = W.QTreeWidgetItem(city)
|
item = W.QTreeWidgetItem(city)
|
||||||
item.setData(0, C.Qt.ItemDataRole.UserRole, key)
|
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()))
|
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 = number(rule.get("limit", 3), 999)
|
||||||
limit.valueChanged.connect(lambda value, key=key: self.map_rule_changed(key, limit=value))
|
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):
|
for i, stage in enumerate(options):
|
||||||
difficulty.model().item(i).setEnabled(stage.unlocked and stage.open)
|
difficulty.model().item(i).setEnabled(stage.unlocked and stage.open)
|
||||||
difficulty.setCurrentIndex(difficulty.findData(chosen.level))
|
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)
|
limit = self.maps_tree.itemWidget(item, 8)
|
||||||
block_limit = C.QSignalBlocker(limit)
|
block_limit = C.QSignalBlocker(limit)
|
||||||
if not limit.hasFocus():
|
if not limit.hasFocus():
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import copy
|
|||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from PySide6 import QtCore as C, QtWidgets as W
|
from PySide6 import QtCore as C, QtWidgets as W
|
||||||
from .model import EggRule, duration
|
from .model import EggRule, duration
|
||||||
from .native_widgets import IntegerInput, RowBatch
|
from .native_widgets import ComboBox, IntegerInput, RowBatch
|
||||||
|
|
||||||
|
|
||||||
class EggTable(W.QTableWidget):
|
class EggTable(W.QTableWidget):
|
||||||
@@ -20,7 +20,7 @@ class EggTable(W.QTableWidget):
|
|||||||
self.setEditTriggers(W.QAbstractItemView.EditTrigger.NoEditTriggers)
|
self.setEditTriggers(W.QAbstractItemView.EditTrigger.NoEditTriggers)
|
||||||
self.setSelectionBehavior(W.QAbstractItemView.SelectionBehavior.SelectRows)
|
self.setSelectionBehavior(W.QAbstractItemView.SelectionBehavior.SelectRows)
|
||||||
self.horizontalHeader().setSectionResizeMode(W.QHeaderView.ResizeMode.Interactive)
|
self.horizontalHeader().setSectionResizeMode(W.QHeaderView.ResizeMode.Interactive)
|
||||||
for column, width in enumerate((130, 45, 65, 65, 90, 95, 95, 95, 160, 95, 90, 90, 100, 100, 160)):
|
for column, width in enumerate((130, 45, 65, 65, 90, 135, 95, 95, 220, 95, 90, 90, 100, 100, 160)):
|
||||||
self.setColumnWidth(column, width)
|
self.setColumnWidth(column, width)
|
||||||
self.verticalHeader().setDefaultSectionSize(24)
|
self.verticalHeader().setDefaultSectionSize(24)
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ class EggTable(W.QTableWidget):
|
|||||||
priority.setToolTip("数字越小,孵化优先级越高")
|
priority.setToolTip("数字越小,孵化优先级越高")
|
||||||
below.setToolTip("可用蛋少于此数量时补货;0表示不自动补货")
|
below.setToolTip("可用蛋少于此数量时补货;0表示不自动补货")
|
||||||
target.setToolTip("补货希望达到的可用蛋数量;市场随机出蛋,实际结果由服务器决定")
|
target.setToolTip("补货希望达到的可用蛋数量;市场随机出蛋,实际结果由服务器决定")
|
||||||
action, market = W.QComboBox(), W.QComboBox()
|
action, market = ComboBox(), ComboBox()
|
||||||
for name, value in (("派遣", "sell"), ("喂养", "feed"), ("保留", "keep")):
|
for name, value in (("派遣", "sell"), ("喂养", "feed"), ("保留", "keep")):
|
||||||
action.addItem(name, value)
|
action.addItem(name, value)
|
||||||
action.setCurrentIndex(max(0, action.findData(rule["action"])))
|
action.setCurrentIndex(max(0, action.findData(rule["action"])))
|
||||||
@@ -99,7 +99,8 @@ class EggTable(W.QTableWidget):
|
|||||||
if not market.count():
|
if not market.count():
|
||||||
market.addItem("金币市场无此蛋", "")
|
market.addItem("金币市场无此蛋", "")
|
||||||
market.setCurrentIndex(max(0, market.findData(rule["market_id"])))
|
market.setCurrentIndex(max(0, market.findData(rule["market_id"])))
|
||||||
market.setMaximumWidth(135)
|
self.setColumnWidth(5, max(self.columnWidth(5), action.minimumSizeHint().width()))
|
||||||
|
self.setColumnWidth(8, max(self.columnWidth(8), market.minimumSizeHint().width()))
|
||||||
controls = {"enabled": enabled, "priority": priority, "action": action, "refill_below": below,
|
controls = {"enabled": enabled, "priority": priority, "action": action, "refill_below": below,
|
||||||
"refill_target": target, "market_id": market}
|
"refill_target": target, "market_id": market}
|
||||||
for column, control in zip(range(3, 9), controls.values()):
|
for column, control in zip(range(3, 9), controls.values()):
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from .engine import Engine
|
|||||||
from .model import Catalog, Policy, WIKI, duration
|
from .model import Catalog, Policy, WIKI, duration
|
||||||
from .egg_rules_gui import EggTable
|
from .egg_rules_gui import EggTable
|
||||||
from .management import expansion_quote, manual_monster_actions
|
from .management import expansion_quote, manual_monster_actions
|
||||||
from .native_widgets import use_native_scrollbars
|
from .native_widgets import ComboBox, use_native_scrollbars
|
||||||
from .login import PasswordLogin, device_id, server_labels
|
from .login import PasswordLogin, device_id, server_labels
|
||||||
from .quests import QuestPolicy
|
from .quests import QuestPolicy
|
||||||
from .daily import DailyPolicy
|
from .daily import DailyPolicy
|
||||||
@@ -64,7 +64,7 @@ def spin(low, high, value, decimals=False):
|
|||||||
|
|
||||||
|
|
||||||
def combo(options):
|
def combo(options):
|
||||||
widget = W.QComboBox()
|
widget = ComboBox()
|
||||||
for text, data in options:
|
for text, data in options:
|
||||||
widget.addItem(text, data)
|
widget.addItem(text, data)
|
||||||
return widget
|
return widget
|
||||||
@@ -84,6 +84,9 @@ def table(headers):
|
|||||||
|
|
||||||
def compact_layouts(widget):
|
def compact_layouts(widget):
|
||||||
for layout in widget.findChildren(W.QLayout):
|
for layout in widget.findChildren(W.QLayout):
|
||||||
|
owner = layout.parentWidget()
|
||||||
|
if owner is not None and owner.window().windowType() == C.Qt.WindowType.Popup:
|
||||||
|
continue
|
||||||
layout.setContentsMargins(4, 4, 4, 4)
|
layout.setContentsMargins(4, 4, 4, 4)
|
||||||
layout.setSpacing(4)
|
layout.setSpacing(4)
|
||||||
if isinstance(layout, W.QFormLayout):
|
if isinstance(layout, W.QFormLayout):
|
||||||
@@ -337,7 +340,7 @@ class Window(ActivityPages, W.QMainWindow):
|
|||||||
login_options.addStretch()
|
login_options.addStretch()
|
||||||
self.login_button = W.QPushButton("账号密码登录并获取区服")
|
self.login_button = W.QPushButton("账号密码登录并获取区服")
|
||||||
self.login_button.clicked.connect(self.password_login)
|
self.login_button.clicked.connect(self.password_login)
|
||||||
self.server_list = W.QComboBox()
|
self.server_list = ComboBox()
|
||||||
self.enter_button = W.QPushButton("进入选中区服")
|
self.enter_button = W.QPushButton("进入选中区服")
|
||||||
self.enter_button.clicked.connect(self.enter_password_server)
|
self.enter_button.clicked.connect(self.enter_password_server)
|
||||||
self.enter_button.setEnabled(False)
|
self.enter_button.setEnabled(False)
|
||||||
@@ -352,7 +355,7 @@ class Window(ActivityPages, W.QMainWindow):
|
|||||||
self.login_status = W.QLabel("未登录:账号验证 → 获取官方区服 → 选择区服 → 进入区服 → 读取角色")
|
self.login_status = W.QLabel("未登录:账号验证 → 获取官方区服 → 选择区服 → 进入区服 → 读取角色")
|
||||||
self.login_status.setWordWrap(True)
|
self.login_status.setWordWrap(True)
|
||||||
form.addRow(self.login_status)
|
form.addRow(self.login_status)
|
||||||
self.saved_sessions = W.QComboBox()
|
self.saved_sessions = ComboBox()
|
||||||
self.saved_sessions.setPlaceholderText("成功读取角色后自动保存会话")
|
self.saved_sessions.setPlaceholderText("成功读取角色后自动保存会话")
|
||||||
restore = W.QPushButton("恢复选中会话(无需重输密码)")
|
restore = W.QPushButton("恢复选中会话(无需重输密码)")
|
||||||
restore.clicked.connect(self.resume_session)
|
restore.clicked.connect(self.resume_session)
|
||||||
|
|||||||
@@ -3,6 +3,75 @@ from PySide6 import QtCore as C, QtGui as G, QtWidgets as W
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
class ComboBox(W.QComboBox):
|
||||||
|
"""Size popups for their text, independently of narrow table columns."""
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
self._text_width = None
|
||||||
|
super().__init__(parent)
|
||||||
|
self.setSizeAdjustPolicy(W.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
|
self.setMinimumContentsLength(6)
|
||||||
|
self.setMaxVisibleItems(12)
|
||||||
|
view = W.QListView(self)
|
||||||
|
view.setTextElideMode(C.Qt.TextElideMode.ElideNone)
|
||||||
|
view.setHorizontalScrollBarPolicy(C.Qt.ScrollBarPolicy.ScrollBarAsNeeded)
|
||||||
|
view.setHorizontalScrollMode(W.QAbstractItemView.ScrollMode.ScrollPerPixel)
|
||||||
|
self.setView(view)
|
||||||
|
for signal in (self.model().dataChanged, self.model().rowsInserted, self.model().rowsRemoved, self.model().modelReset):
|
||||||
|
signal.connect(self.invalidate_width)
|
||||||
|
|
||||||
|
def invalidate_width(self, *args):
|
||||||
|
self._text_width = None
|
||||||
|
self.updateGeometry()
|
||||||
|
|
||||||
|
def text_width(self):
|
||||||
|
if self._text_width is None:
|
||||||
|
self._text_width = max((self.fontMetrics().horizontalAdvance(self.itemText(i)) for i in range(self.count())), default=0)
|
||||||
|
return self._text_width
|
||||||
|
|
||||||
|
def sizeHint(self):
|
||||||
|
hint = super().sizeHint()
|
||||||
|
hint.setWidth(max(120, hint.width(), min(360, self.text_width() + 48)))
|
||||||
|
return hint
|
||||||
|
|
||||||
|
def minimumSizeHint(self):
|
||||||
|
hint = super().minimumSizeHint()
|
||||||
|
hint.setWidth(max(120, hint.width(), min(260, self.text_width() + 48)))
|
||||||
|
return hint
|
||||||
|
|
||||||
|
def changeEvent(self, event):
|
||||||
|
if event.type() in (C.QEvent.Type.FontChange, C.QEvent.Type.StyleChange):
|
||||||
|
self.invalidate_width()
|
||||||
|
super().changeEvent(event)
|
||||||
|
|
||||||
|
def showPopup(self):
|
||||||
|
view = self.view()
|
||||||
|
screen = self.screen().availableGeometry()
|
||||||
|
scrollbar = view.verticalScrollBar().sizeHint().width()
|
||||||
|
content = max(self.text_width() + 16, view.sizeHintForColumn(0))
|
||||||
|
width = min(screen.width(), max(self.width(), content + scrollbar + 2 * view.frameWidth() + 8))
|
||||||
|
popup = view.window()
|
||||||
|
frame = popup.frameWidth() if isinstance(popup, W.QFrame) else 0
|
||||||
|
view.setMinimumWidth(max(0, width - 2 * frame))
|
||||||
|
super().showPopup()
|
||||||
|
# QComboBox resets this policy while opening its popup.
|
||||||
|
view.setHorizontalScrollBarPolicy(C.Qt.ScrollBarPolicy.ScrollBarAsNeeded)
|
||||||
|
popup.resize(width, popup.height())
|
||||||
|
view.doItemsLayout()
|
||||||
|
if view.horizontalScrollBar().maximum() > 0:
|
||||||
|
popup.resize(width, min(screen.height(), popup.height() + view.horizontalScrollBar().sizeHint().height()))
|
||||||
|
popup.move(min(max(popup.x(), screen.left()), screen.right() - popup.width() + 1),
|
||||||
|
min(max(popup.y(), screen.top()), screen.bottom() - popup.height() + 1))
|
||||||
|
|
||||||
|
def event(self, event):
|
||||||
|
if event.type() == C.QEvent.Type.ToolTip and self.currentText():
|
||||||
|
text = self.currentText()
|
||||||
|
if self.toolTip() and self.toolTip() != text:
|
||||||
|
text += "\n" + self.toolTip()
|
||||||
|
W.QToolTip.showText(event.globalPos(), text, self)
|
||||||
|
return True
|
||||||
|
return super().event(event)
|
||||||
|
|
||||||
|
|
||||||
class RowBatch(C.QObject):
|
class RowBatch(C.QObject):
|
||||||
"""Create Qt rows in short event-loop slices, keeping input responsive."""
|
"""Create Qt rows in short event-loop slices, keeping input responsive."""
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
import os
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
||||||
|
from PySide6 import QtCore as C, QtGui as G, QtWidgets as W
|
||||||
|
|
||||||
|
from ranch_assistant.gui import combo, compact_layouts
|
||||||
|
from ranch_assistant.native_widgets import ComboBox, use_native_scrollbars
|
||||||
|
|
||||||
|
|
||||||
|
class ComboBoxTests(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.app = W.QApplication.instance() or W.QApplication([])
|
||||||
|
use_native_scrollbars()
|
||||||
|
|
||||||
|
def test_popup_fits_longest_option_despite_narrow_control_and_wide_scrollbar(self):
|
||||||
|
widget = combo([("随机30秒", 30), ("四项全S(4S)才保留", 6), ("随机2分钟", 120), ("随机5分钟", 300)])
|
||||||
|
widget.setStyle(W.QStyleFactory.create("Windows"))
|
||||||
|
self.assertGreaterEqual(widget.minimumSizeHint().width(), widget.fontMetrics().horizontalAdvance("四项全S(4S)才保留") + 40)
|
||||||
|
widget.setFixedWidth(100)
|
||||||
|
widget.show()
|
||||||
|
try:
|
||||||
|
self.app.processEvents()
|
||||||
|
widget.showPopup()
|
||||||
|
self.app.processEvents()
|
||||||
|
view = widget.view()
|
||||||
|
needed = max(view.fontMetrics().horizontalAdvance(widget.itemText(i)) for i in range(widget.count())) + 16
|
||||||
|
self.assertGreaterEqual(view.viewport().width(), needed)
|
||||||
|
finally:
|
||||||
|
widget.hidePopup()
|
||||||
|
widget.close()
|
||||||
|
|
||||||
|
def test_dynamic_options_remeasure_and_popup_stays_on_screen(self):
|
||||||
|
widget = ComboBox()
|
||||||
|
widget.setStyle(W.QStyleFactory.create("Windows"))
|
||||||
|
widget.addItem("派遣")
|
||||||
|
widget.setFixedWidth(100)
|
||||||
|
widget.show()
|
||||||
|
try:
|
||||||
|
widget.showPopup()
|
||||||
|
self.app.processEvents()
|
||||||
|
original = widget.view().window().width()
|
||||||
|
widget.hidePopup()
|
||||||
|
label = "莉莉托斯市场 · 每批十连 · 保留金币并限制每日额度"
|
||||||
|
widget.addItem(label)
|
||||||
|
widget.showPopup()
|
||||||
|
self.app.processEvents()
|
||||||
|
self.assertGreater(widget.view().window().width(), original)
|
||||||
|
self.assertGreaterEqual(widget.view().viewport().width(), widget.fontMetrics().horizontalAdvance(label) + 16)
|
||||||
|
self.assertTrue(widget.screen().availableGeometry().contains(widget.view().window().geometry()))
|
||||||
|
widget.hidePopup()
|
||||||
|
widget.setItemText(1, "短选项")
|
||||||
|
widget.showPopup()
|
||||||
|
self.app.processEvents()
|
||||||
|
self.assertLess(widget.view().window().width(), widget.fontMetrics().horizontalAdvance(label))
|
||||||
|
finally:
|
||||||
|
widget.hidePopup()
|
||||||
|
widget.close()
|
||||||
|
|
||||||
|
def test_screen_wide_labels_scroll_and_hover_keeps_full_text_and_help(self):
|
||||||
|
label = "魔物名称与编号" * 100
|
||||||
|
widget = combo([(label, 1)])
|
||||||
|
widget.setToolTip("保留策略说明")
|
||||||
|
widget.setFixedWidth(100)
|
||||||
|
widget.show()
|
||||||
|
try:
|
||||||
|
widget.showPopup()
|
||||||
|
self.app.processEvents()
|
||||||
|
self.assertLessEqual(widget.view().window().width(), widget.screen().availableGeometry().width())
|
||||||
|
self.assertGreater(widget.view().horizontalScrollBar().maximum(), 0)
|
||||||
|
widget.hidePopup()
|
||||||
|
event = G.QHelpEvent(C.QEvent.Type.ToolTip, C.QPoint(5, 5), widget.mapToGlobal(C.QPoint(5, 5)))
|
||||||
|
with patch.object(W.QToolTip, "showText") as tooltip:
|
||||||
|
self.app.sendEvent(widget, event)
|
||||||
|
self.assertEqual(tooltip.call_args.args[1], label + "\n保留策略说明")
|
||||||
|
finally:
|
||||||
|
widget.hidePopup()
|
||||||
|
widget.close()
|
||||||
|
|
||||||
|
def test_compact_page_layout_keeps_short_popup_options_fully_visible(self):
|
||||||
|
page = W.QWidget()
|
||||||
|
layout = W.QVBoxLayout(page)
|
||||||
|
widget = combo([("随机30秒", 30), ("随机60秒", 60), ("随机2分钟", 120), ("随机5分钟", 300)])
|
||||||
|
layout.addWidget(widget)
|
||||||
|
compact_layouts(page)
|
||||||
|
page.show()
|
||||||
|
try:
|
||||||
|
self.app.processEvents()
|
||||||
|
widget.showPopup()
|
||||||
|
self.app.processEvents()
|
||||||
|
view = widget.view()
|
||||||
|
last = view.visualRect(view.model().index(widget.count() - 1, 0))
|
||||||
|
self.assertLess(last.bottom(), view.viewport().height())
|
||||||
|
finally:
|
||||||
|
widget.hidePopup()
|
||||||
|
page.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in New Issue
Block a user