diff --git a/PPOCRLabel/PPOCRLabel.py b/PPOCRLabel/PPOCRLabel.py index 11eda1a954d109d2155481d4a6d432983df8e97f..a2906e71756e4f4cdd1d254c693b2cce70fe8b15 100644 --- a/PPOCRLabel/PPOCRLabel.py +++ b/PPOCRLabel/PPOCRLabel.py @@ -162,11 +162,14 @@ class MainWindow(QMainWindow): # ================== Key List ================== if self.kie_mode: - # self.keyList = QListWidget() self.keyList = UniqueLabelQListWidget() - # self.keyList.itemSelectionChanged.connect(self.keyListSelectionChanged) - # self.keyList.itemDoubleClicked.connect(self.editBox) - # self.keyList.itemChanged.connect(self.keyListItemChanged) + + # set key list height + key_list_height = int(QApplication.desktop().height() // 4) + if key_list_height < 50: + key_list_height = 50 + self.keyList.setMaximumHeight(key_list_height) + self.keyListDockName = getStr('keyListTitle') self.keyListDock = QDockWidget(self.keyListDockName, self) self.keyListDock.setWidget(self.keyList) diff --git a/PPOCRLabel/libs/unique_label_qlist_widget.py b/PPOCRLabel/libs/unique_label_qlist_widget.py index f1eff7a172d3fecf9c18579ccead5f62ba65ecd5..07ae05fe67d8b1a924d04666220e33f664891e83 100644 --- a/PPOCRLabel/libs/unique_label_qlist_widget.py +++ b/PPOCRLabel/libs/unique_label_qlist_widget.py @@ -1,6 +1,6 @@ # -*- encoding: utf-8 -*- -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QSize from PyQt5 import QtWidgets @@ -40,6 +40,7 @@ class UniqueLabelQListWidget(EscapableQListWidget): qlabel.setText(' {} '.format(*color, label)) qlabel.setAlignment(Qt.AlignBottom) - item.setSizeHint(qlabel.sizeHint()) + # item.setSizeHint(qlabel.sizeHint()) + item.setSizeHint(QSize(25, 25)) self.setItemWidget(item, qlabel)