forked from Delen0828/mAIDo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
listui.py
85 lines (81 loc) · 3.94 KB
/
listui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'listui.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
def mousepressdec(_class):
def mousePressEvent(self,event):
super().mousePressEvent(event)
setattr(_class, 'mousePressEvent', mousePressEvent)
return _class # Decorated class
class mylistwidget(QtWidgets.QListWidget):
def __init__(self,parent):
super().__init__(parent)
def mousePressEvent(self,event):
self.clearSelection()
super().mousePressEvent(event)
def dropEvent(self, event) :
pos = event.pos()
taritem=self.itemAt(pos)
if taritem==None:
print('非法拖拽位置')
else:
print(taritem.label.text())
super().dropEvent(event)
class listUi(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(373, 534)
self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setSpacing(0)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.frame = QtWidgets.QFrame(Form)
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.frame)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setSpacing(0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.toolButton_2 = QtWidgets.QToolButton(self.frame)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(self.toolButton_2.sizePolicy().hasHeightForWidth())
self.toolButton_2.setSizePolicy(sizePolicy)
self.toolButton_2.setMinimumSize(QtCore.QSize(70, 0))
self.toolButton_2.setMaximumSize(QtCore.QSize(100, 35))
self.toolButton_2.setObjectName("toolButton_2")
self.horizontalLayout_2.addWidget(self.toolButton_2)
self.toolButton = QtWidgets.QToolButton(self.frame)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(self.toolButton.sizePolicy().hasHeightForWidth())
self.toolButton.setSizePolicy(sizePolicy)
self.toolButton.setMinimumSize(QtCore.QSize(70, 0))
self.toolButton.setMaximumSize(QtCore.QSize(100, 35))
self.toolButton.setObjectName("toolButton")
self.horizontalLayout_2.addWidget(self.toolButton)
self.verticalLayout_3.addWidget(self.frame, 0, QtCore.Qt.AlignLeft)
self.listWidget = mylistwidget(Form)
self.listWidget.setObjectName("listWidget")
self.verticalLayout_3.addWidget(self.listWidget)
self.verticalLayout_3.setStretch(1, 20)
self.horizontalLayout.addLayout(self.verticalLayout_3)
self.toolButton_2.clicked.connect(lambda: Form.listwindowadd())
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
#self.listWidget=mousepressdec(self.listWidget)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.toolButton_2.setText(_translate("Form", "Add"))
self.toolButton.setText(_translate("Form", "Sort"))