提交 74f44dd2 编写于 作者: HinGwenWoong's avatar HinGwenWoong

the height of key list set to a quarter of the windows height

上级 6bb6a83d
...@@ -162,11 +162,14 @@ class MainWindow(QMainWindow): ...@@ -162,11 +162,14 @@ class MainWindow(QMainWindow):
# ================== Key List ================== # ================== Key List ==================
if self.kie_mode: if self.kie_mode:
# self.keyList = QListWidget()
self.keyList = UniqueLabelQListWidget() self.keyList = UniqueLabelQListWidget()
# self.keyList.itemSelectionChanged.connect(self.keyListSelectionChanged)
# self.keyList.itemDoubleClicked.connect(self.editBox) # set key list height
# self.keyList.itemChanged.connect(self.keyListItemChanged) 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.keyListDockName = getStr('keyListTitle')
self.keyListDock = QDockWidget(self.keyListDockName, self) self.keyListDock = QDockWidget(self.keyListDockName, self)
self.keyListDock.setWidget(self.keyList) self.keyListDock.setWidget(self.keyList)
......
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt, QSize
from PyQt5 import QtWidgets from PyQt5 import QtWidgets
...@@ -40,6 +40,7 @@ class UniqueLabelQListWidget(EscapableQListWidget): ...@@ -40,6 +40,7 @@ class UniqueLabelQListWidget(EscapableQListWidget):
qlabel.setText('<font color="#{:02x}{:02x}{:02x}">●</font> {} '.format(*color, label)) qlabel.setText('<font color="#{:02x}{:02x}{:02x}">●</font> {} '.format(*color, label))
qlabel.setAlignment(Qt.AlignBottom) qlabel.setAlignment(Qt.AlignBottom)
item.setSizeHint(qlabel.sizeHint()) # item.setSizeHint(qlabel.sizeHint())
item.setSizeHint(QSize(25, 25))
self.setItemWidget(item, qlabel) self.setItemWidget(item, qlabel)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册