【PyQt】redirect keyboard events to QTextEdit when it has no focus ?
when the QTextEdit doesn’t have focus ,how to redirect keyboard events to the text editor ?
as This saves the user from clicking the text editor before entering text, making the application more user-friendly.
as This saves the user from clicking the text editor before entering text, making the application more user-friendly.
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class BoxLayout(QWidget):
def __init__(self, parent=None):
super(BoxLayout, self).__init__(parent)
# self.resize(100, 300)
ok = QPushButton("OK")
cancel = QPushButton("Cancel")
self.textEdit = QTextEdit()
vbox = QVBoxLayout()
vbox.addWidget(self.textEdit)
vbox.addWidget(ok)
vbox.addWidget(cancel)
self.setLayout(vbox)
app = QApplication(sys.argv)
qb = BoxLayout()
qb.show()
sys.exit(app.exec_())
...全文
相关推荐
产业园区运营负责人如何提升园区企业的技术需求对接效率和转化成功率?.docx
产业园区运营负责人如何提升园区企业的技术需求对接效率和转化成功率?
产业园区运营负责人如何提升园区内企业与科研机构的协同创新能力?.docx
产业园区运营负责人如何提升园区内企业与科研机构的协同创新能力?
数字高校智慧校园AI知识库平台规划方案(决策评审版).pptx
数字高校智慧校园AI知识库平台规划方案(决策评审版).pptx
科技中介服务机构如何提升技术交易撮合的精准度与成功率?.docx
科技中介服务机构如何提升技术交易撮合的精准度与成功率?
国央企创新负责人如何通过平台实现科技成果的定向匹配与快速转化?.docx
科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。



