Skip to content

Commit 2ba760e

Browse files
committed
修复历史发送列表内容太长,强制使用最小大小导致超出屏幕后,弹窗无法渲染的问题,增加默认最大不超过屏幕。
1 parent 4812b1e commit 2ba760e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

COMTool/Combobox.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from PyQt5.QtWidgets import QComboBox,QListView
1+
from PyQt5.QtWidgets import QComboBox,QListView,QApplication
22
from PyQt5.QtCore import pyqtSignal
33

44

@@ -21,6 +21,14 @@ def showPopup(self):
2121
pass
2222

2323
def _showPopup(self):
24+
max_w = 0
25+
for i in range(self.count()):
26+
w = self.view().sizeHintForColumn(i)
27+
if w > max_w:
28+
max_w = w
29+
30+
screen_width = QApplication.desktop().availableGeometry().width()
31+
self.view().setMinimumWidth(min(max_w + 50, screen_width))
2432
super(ComboBox, self).showPopup()
2533

2634
def showItems(self):

0 commit comments

Comments
 (0)