Просмотр исходного кода

修复了输入框右键弹出框架自带提示框的问题

wzp 3 месяцев назад
Родитель
Сommit
f082c3cac4
1 измененных файлов: 12 добавлений и 3 удалений
  1. 12
    3
      Front/modules/ui_main.py

+ 12
- 3
Front/modules/ui_main.py Просмотреть файл

@@ -39,6 +39,16 @@ from watchdog.observers import Observer
39 39
 from .resources_rc import *
40 40
 
41 41
 
42
+# 自定义 QLineEdit 类,屏蔽右键菜单
43
+class CustomLineEdit(QLineEdit):
44
+    def __init__(self, parent=None):
45
+        super().__init__(parent)
46
+
47
+    def contextMenuEvent(self, event):
48
+        # 不执行任何操作,屏蔽右键菜单
49
+        pass
50
+
51
+
42 52
 class Ui_MainWindow(object):
43 53
     # UI界面
44 54
     def setupUi(self, MainWindow):
@@ -1337,7 +1347,7 @@ class Ui_MainWindow(object):
1337 1347
 
1338 1348
         self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
1339 1349
 
1340
-        self.lineEdit = QLineEdit(self.frame_content_wid_1)
1350
+        self.lineEdit = CustomLineEdit(self.frame_content_wid_1)
1341 1351
         self.lineEdit.setObjectName(u"lineEdit")
1342 1352
         self.lineEdit.setMinimumSize(QSize(0, 25))
1343 1353
         self.lineEdit.setMaximumSize(QSize(250, 35))
@@ -1584,7 +1594,7 @@ class Ui_MainWindow(object):
1584 1594
         self.verticalLayout_24.setObjectName(u"verticalLayout_24")
1585 1595
         self.horizontalLayout_12 = QHBoxLayout()
1586 1596
         self.horizontalLayout_12.setObjectName(u"horizontalLayout_12")
1587
-        self.lineEdit_2 = QLineEdit(self.datainfo)
1597
+        self.lineEdit_2 = CustomLineEdit(self.datainfo)
1588 1598
         self.lineEdit_2.setObjectName(u"lineEdit_2")
1589 1599
         self.lineEdit_2.setStyleSheet(u"background-color: rgb(33, 37, 43);")
1590 1600
 
@@ -2055,4 +2065,3 @@ class Ui_MainWindow(object):
2055 2065
         self.btn_message.setText(QCoreApplication.translate("MainWindow", u"\u5207\u6362\u4e3b\u9898", None))
2056 2066
         self.creditsLabel.setText(QCoreApplication.translate("MainWindow", u"\u7248\u6743\u4fe1\u606f", None))
2057 2067
         self.version.setText(QCoreApplication.translate("MainWindow", u"v1.0.0", None))
2058
-

Загрузка…
Отмена
Сохранить