- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的应用场景:
从串口读取连续数据(实时)并显示在 PyQt GUI 上,并将数据存储在 csv 文件中。
我尝试使用While循环。 <-- 由于调用阻塞而不起作用。
所以,二手我尝试过QtCore.QTimer.singleShot(1, methodname)。哪个抛出递归异常。
我的代码:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\TUK\Master Thesis\ML\Lable_Data.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import traceback
import os
import sys
import serial
import atexit
import time
write_path = "recording_folder1/"
port = "COM6" # COM for windows, it changes when we use unix system
#ser = serial.Serial(port, 115200, timeout=None)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(850, 568)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("C:/Users/HackoMan/Google Drive/MasterThesis/Code/QtDesigner/Icon/research4-1.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.DataLabelingTabObj = QtWidgets.QTabWidget(self.centralwidget)
self.DataLabelingTabObj.setObjectName("DataLabelingTabObj")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.formLayoutWidget = QtWidgets.QWidget(self.tab)
self.formLayoutWidget.setGeometry(QtCore.QRect(10, 10, 811, 481))
self.formLayoutWidget.setObjectName("formLayoutWidget")
self.gridLayout_2 = QtWidgets.QGridLayout(self.formLayoutWidget)
self.gridLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
self.gridLayout_2.setObjectName("gridLayout_2")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.startCaptureBtn = QtWidgets.QPushButton(self.formLayoutWidget)
self.startCaptureBtn.setObjectName("startCaptureBtn")
self.horizontalLayout.addWidget(self.startCaptureBtn)
self.stopCaptureBtn = QtWidgets.QPushButton(self.formLayoutWidget)
self.stopCaptureBtn.setEnabled(False)
self.stopCaptureBtn.setObjectName("stopCaptureBtn")
self.horizontalLayout.addWidget(self.stopCaptureBtn)
self.gridLayout_2.addLayout(self.horizontalLayout, 3, 1, 1, 1)
self.fileNameLabel = QtWidgets.QLabel(self.formLayoutWidget)
self.fileNameLabel.setObjectName("fileNameLabel")
self.gridLayout_2.addWidget(self.fileNameLabel, 0, 0, 1, 1)
self.fileNameLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget)
self.fileNameLineEdit.setObjectName("fileNameLineEdit")
self.gridLayout_2.addWidget(self.fileNameLineEdit, 0, 1, 1, 1)
self.label = QtWidgets.QLabel(self.formLayoutWidget)
self.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1)
self.classLabelLabel = QtWidgets.QLabel(self.formLayoutWidget)
self.classLabelLabel.setObjectName("classLabelLabel")
self.gridLayout_2.addWidget(self.classLabelLabel, 1, 0, 1, 1)
self.classLabelLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget)
self.classLabelLineEdit.setObjectName("classLabelLineEdit")
self.gridLayout_2.addWidget(self.classLabelLineEdit, 1, 1, 1, 1)
self.sensorTextEdit = QtWidgets.QTextEdit(self.formLayoutWidget)
self.sensorTextEdit.setReadOnly(True)
self.sensorTextEdit.setObjectName("sensorTextEdit")
self.gridLayout_2.addWidget(self.sensorTextEdit, 2, 1, 1, 1)
self.label_2 = QtWidgets.QLabel(self.formLayoutWidget)
self.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 3, 0, 1, 1)
self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
self.horizontalLayout_8.setObjectName("horizontalLayout_8")
self.resetBtn = QtWidgets.QPushButton(self.formLayoutWidget)
self.resetBtn.setObjectName("resetBtn")
self.horizontalLayout_8.addWidget(self.resetBtn)
self.closeBtn = QtWidgets.QPushButton(self.formLayoutWidget)
self.closeBtn.setObjectName("closeBtn")
self.horizontalLayout_8.addWidget(self.closeBtn)
self.gridLayout_2.addLayout(self.horizontalLayout_8, 4, 1, 1, 1)
self.DataLabelingTabObj.addTab(self.tab, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.DataLabelingTabObj.addTab(self.tab_2, "")
self.gridLayout.addWidget(self.DataLabelingTabObj, 0, 1, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
self.DataLabelingTabObj.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.addButtonOperations()
self.addFiledsValidators()
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Data Collection"))
self.startCaptureBtn.setToolTip(_translate("MainWindow", "click to capture the sensor data"))
self.startCaptureBtn.setWhatsThis(_translate("MainWindow", "click to capture the sensor data"))
self.startCaptureBtn.setText(_translate("MainWindow", "Start"))
self.stopCaptureBtn.setText(_translate("MainWindow", "Stop"))
self.fileNameLabel.setText(_translate("MainWindow", "FileName"))
self.label.setText(_translate("MainWindow", "Sensor Data"))
self.classLabelLabel.setText(_translate("MainWindow", "ClassLabel"))
self.label_2.setText(_translate("MainWindow", "Capture Sensor Data"))
self.resetBtn.setText(_translate("MainWindow", "Reset"))
self.closeBtn.setText(_translate("MainWindow", "Close"))
self.DataLabelingTabObj.setTabText(self.DataLabelingTabObj.indexOf(self.tab), _translate("MainWindow", "Data labeling"))
self.DataLabelingTabObj.setTabText(self.DataLabelingTabObj.indexOf(self.tab_2), _translate("MainWindow", "Classifier"))
def addButtonOperations(self):
self.closeBtn.clicked.connect(self.closeWindow)
self.resetBtn.clicked.connect(self.resetFields)
self.startCaptureBtn.clicked.connect(self.startCaptureBtnPressedEvent)
self.stopCaptureBtn.clicked.connect(self.stopCaptureSensorData)
def addFiledsValidators(self):
regexp = QtCore.QRegExp('[a-zA-Z0-9_ -]+')
validator = QtGui.QRegExpValidator(regexp)
self.fileNameLineEdit.setValidator(validator)
self.classLabelLineEdit.setValidator(validator)
def captureSensorData(self, file):
current_label = self.classLabelLineEdit.text()
# new_line = ser.readline().decode('utf-8').rstrip()
new_line = "test1, Test2, Test3"
new_line = new_line + ',' + current_label + '\n'
file.write(new_line)
file.flush()
self.sensorTextEdit.append(new_line)
self.sensorTextEdit.repaint()
if not self.startCaptureBtn.isEnabled():
QtCore.QTimer.singleShot(1, self.captureSensorData(file))
else:
file.close()
def startCaptureBtnPressedEvent(self):
try:
if(self.isValidFields()):
# capture the sensor data
print("#capturing the sensor data")
self.startCaptureBtn.setEnabled(False)
self.stopCaptureBtn.setEnabled(True)
self.startCaptureBtn.repaint()
self.stopCaptureBtn.repaint()
file = self.openFileForWriting() # Create/Open file for saving sensor data
if not self.startCaptureBtn.isEnabled():
QtCore.QTimer.singleShot(1, self.captureSensorData(file))
else:
# throw error message
print("#throw error message")
msgBox = QtWidgets.QMessageBox()
msgBox.setText("Please fill the required fields ")
msgBox.setWindowTitle("Warning !! ")
msgBox.setIcon(QtWidgets.QMessageBox.Warning)
msgBox.exec()
except:
traceback.print_exc()
def openFileForWriting(self):
os.makedirs(os.path.dirname(write_path), exist_ok=True)
file_name = self.fileNameLineEdit.text()
file_name = write_path + file_name + ".csv"
file = open(file_name, 'a')
return file
def stopCaptureSensorData(self):
# stop capture the sensor data
print("# stop capturing the sensor data")
self.startCaptureBtn.setEnabled(True)
self.stopCaptureBtn.setEnabled(False)
self.startCaptureBtn.repaint()
self.stopCaptureBtn.repaint()
def isValidFields(self):
if(self.fileNameLineEdit.text().__len__()<=0 or self.classLabelLineEdit.text().__len__()<=0):
return False
else:
return True
def resetFields(self):
self.fileNameLineEdit.clear()
self.classLabelLineEdit.clear()
self.sensorTextEdit.clear()
def closeWindow(self):
QtCore.QCoreApplication.instance().quit()
def releaseResource(self):
print("Release Resources !!! ")
#if ser.isOpen():
# ser.close()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
atexit.register(ui.releaseResource)
sys.exit(app.exec_())
如果您执行类似的操作(例如读取数据库数据并在 GUI 上显示...等),或者是否有人在 pyqt 中找到了解决方案,请告诉我。
最佳答案
根据上面的评论之一,我在没有任何参数的情况下尝试过,问题已解决。使用captureSensorData而不是captureSensorData(file)
解决方案:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\TUK\Master Thesis\ML\Lable_Data.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import traceback
import os
import sys
import serial
import atexit
write_path = "recording_folder1/"
port = "COM6" # COM for windows, it changes when we use unix system
ser = serial.Serial(port, 115200, timeout=None)
file = None
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(850, 568)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("C:/Users/HackoMan/Google Drive/MasterThesis/Code/QtDesigner/Icon/research4-1.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.DataLabelingTabObj = QtWidgets.QTabWidget(self.centralwidget)
self.DataLabelingTabObj.setObjectName("DataLabelingTabObj")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.formLayoutWidget = QtWidgets.QWidget(self.tab)
self.formLayoutWidget.setGeometry(QtCore.QRect(10, 10, 811, 481))
self.formLayoutWidget.setObjectName("formLayoutWidget")
self.gridLayout_2 = QtWidgets.QGridLayout(self.formLayoutWidget)
self.gridLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
self.gridLayout_2.setObjectName("gridLayout_2")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.startCaptureBtn = QtWidgets.QPushButton(self.formLayoutWidget)
self.startCaptureBtn.setObjectName("startCaptureBtn")
self.horizontalLayout.addWidget(self.startCaptureBtn)
self.stopCaptureBtn = QtWidgets.QPushButton(self.formLayoutWidget)
self.stopCaptureBtn.setEnabled(False)
self.stopCaptureBtn.setObjectName("stopCaptureBtn")
self.horizontalLayout.addWidget(self.stopCaptureBtn)
self.gridLayout_2.addLayout(self.horizontalLayout, 3, 1, 1, 1)
self.fileNameLabel = QtWidgets.QLabel(self.formLayoutWidget)
self.fileNameLabel.setObjectName("fileNameLabel")
self.gridLayout_2.addWidget(self.fileNameLabel, 0, 0, 1, 1)
self.fileNameLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget)
self.fileNameLineEdit.setObjectName("fileNameLineEdit")
self.gridLayout_2.addWidget(self.fileNameLineEdit, 0, 1, 1, 1)
self.label = QtWidgets.QLabel(self.formLayoutWidget)
self.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1)
self.classLabelLabel = QtWidgets.QLabel(self.formLayoutWidget)
self.classLabelLabel.setObjectName("classLabelLabel")
self.gridLayout_2.addWidget(self.classLabelLabel, 1, 0, 1, 1)
self.classLabelLineEdit = QtWidgets.QLineEdit(self.formLayoutWidget)
self.classLabelLineEdit.setObjectName("classLabelLineEdit")
self.gridLayout_2.addWidget(self.classLabelLineEdit, 1, 1, 1, 1)
self.sensorTextEdit = QtWidgets.QTextEdit(self.formLayoutWidget)
self.sensorTextEdit.setReadOnly(True)
self.sensorTextEdit.setObjectName("sensorTextEdit")
self.gridLayout_2.addWidget(self.sensorTextEdit, 2, 1, 1, 1)
self.label_2 = QtWidgets.QLabel(self.formLayoutWidget)
self.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 3, 0, 1, 1)
self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
self.horizontalLayout_8.setObjectName("horizontalLayout_8")
self.resetBtn = QtWidgets.QPushButton(self.formLayoutWidget)
self.resetBtn.setObjectName("resetBtn")
self.horizontalLayout_8.addWidget(self.resetBtn)
self.closeBtn = QtWidgets.QPushButton(self.formLayoutWidget)
self.closeBtn.setObjectName("closeBtn")
self.horizontalLayout_8.addWidget(self.closeBtn)
self.gridLayout_2.addLayout(self.horizontalLayout_8, 4, 1, 1, 1)
self.DataLabelingTabObj.addTab(self.tab, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.DataLabelingTabObj.addTab(self.tab_2, "")
self.gridLayout.addWidget(self.DataLabelingTabObj, 0, 1, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
self.DataLabelingTabObj.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.addButtonOperations()
self.addFiledsValidators()
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Data Collection"))
self.startCaptureBtn.setToolTip(_translate("MainWindow", "click to capture the sensor data"))
self.startCaptureBtn.setWhatsThis(_translate("MainWindow", "click to capture the sensor data"))
self.startCaptureBtn.setText(_translate("MainWindow", "Start"))
self.stopCaptureBtn.setText(_translate("MainWindow", "Stop"))
self.fileNameLabel.setText(_translate("MainWindow", "FileName"))
self.label.setText(_translate("MainWindow", "Sensor Data"))
self.classLabelLabel.setText(_translate("MainWindow", "ClassLabel"))
self.label_2.setText(_translate("MainWindow", "Capture Sensor Data"))
self.resetBtn.setText(_translate("MainWindow", "Reset"))
self.closeBtn.setText(_translate("MainWindow", "Close"))
self.DataLabelingTabObj.setTabText(self.DataLabelingTabObj.indexOf(self.tab), _translate("MainWindow", "Data labeling"))
self.DataLabelingTabObj.setTabText(self.DataLabelingTabObj.indexOf(self.tab_2), _translate("MainWindow", "Classifier"))
def addButtonOperations(self):
self.closeBtn.clicked.connect(self.closeWindow)
self.resetBtn.clicked.connect(self.resetFields)
self.startCaptureBtn.clicked.connect(self.startCaptureBtnPressedEvent)
self.stopCaptureBtn.clicked.connect(self.stopCaptureSensorData)
def addFiledsValidators(self):
regexp = QtCore.QRegExp('[a-zA-Z0-9_ -]+')
validator = QtGui.QRegExpValidator(regexp)
self.fileNameLineEdit.setValidator(validator)
self.classLabelLineEdit.setValidator(validator)
def captureSensorData(self):
try:
current_label = self.classLabelLineEdit.text()
#new_line = ser.readline().decode('utf-8').rstrip()
new_line = "test1, Test2, Test3"
new_line = new_line + ',' + current_label + '\n'
self.file.write(new_line)
self.file.flush()
self.sensorTextEdit.append(new_line)
self.sensorTextEdit.repaint()
if not self.startCaptureBtn.isEnabled():
QtCore.QTimer.singleShot(1, self.captureSensorData)
else:
self.file.close()
except:
traceback.print_exc()
def startCaptureBtnPressedEvent(self):
try:
if(self.isValidFields()):
# capture the sensor data
print("#capturing the sensor data")
self.startCaptureBtn.setEnabled(False)
self.stopCaptureBtn.setEnabled(True)
self.startCaptureBtn.repaint()
self.stopCaptureBtn.repaint()
self.file = self.openFileForWriting() # Create/Open file for saving sensor data
if not self.startCaptureBtn.isEnabled():
QtCore.QTimer.singleShot(1, self.captureSensorData)
else:
# throw error message
print("#throw error message")
msgBox = QtWidgets.QMessageBox()
msgBox.setText("Please fill the required fields ")
msgBox.setWindowTitle("Warning !! ")
msgBox.setIcon(QtWidgets.QMessageBox.Warning)
msgBox.exec()
except:
traceback.print_exc()
def openFileForWriting(self):
os.makedirs(os.path.dirname(write_path), exist_ok=True)
file_name = self.fileNameLineEdit.text()
file_name = write_path + file_name + ".csv"
file = open(file_name, 'a')
return file
def stopCaptureSensorData(self):
# stop capture the sensor data
print("# stop capturing the sensor data")
self.startCaptureBtn.setEnabled(True)
self.stopCaptureBtn.setEnabled(False)
self.startCaptureBtn.repaint()
self.stopCaptureBtn.repaint()
def isValidFields(self):
if(self.fileNameLineEdit.text().__len__()<=0 or self.classLabelLineEdit.text().__len__()<=0):
return False
else:
return True
def resetFields(self):
self.fileNameLineEdit.clear()
self.classLabelLineEdit.clear()
self.sensorTextEdit.clear()
def closeWindow(self):
QtCore.QCoreApplication.instance().quit()
def releaseResource(self):
print("Release Resources !!! ")
if ser.isOpen():
ser.close()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
atexit.register(ui.releaseResource)
sys.exit(app.exec_())
关于python - PyQT实时显示串口数据在QtCore.QTimer.singleShot()上抛出最大递归深度超出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51234288/
当(且仅当)我退出我的应用程序时,这些(且仅这些)重复消息出现在命令提示符上: QObject::startTimer: QTimer can only be used with threads st
我有一个 QObject 的子类,称为 myObject,它在构造函数的堆上分配了一个 QTimer 数据成员。 myObject 还有一个插槽,它连接到构造函数中的 QTimer timeout()
考虑以下C++语句(示例from docs): QTimer::singleShot(600000, &app, SLOT(quit())); 如何在.qml JavaScript中执行相同的操作,例
文档中说: In multithreaded applications, you can use QTimer in any thread that has an event loop. To sta
文档中说: In multithreaded applications, you can use QTimer in any thread that has an event loop. To sta
我有一个派生自 QThread 的对象,类定义包括 Q_OBJECT 宏。我在线程中创建了一个计时器,这样我就可以在线程运行时进行一些偶尔的检查;但是,超时事件永远不会发生。 我也试过将计时器设置为单
在 Qt 中,我试图设置一个 QTimer每秒调用一个名为“更新”的函数。这是我的 .cpp 文件: #include "mainwindow.h" #include "ui_mainwindow.h
我刚开始使用 Qt 并了解了 QTimers。不幸的是,他们似乎给出了一个错误,我还没有看到在线描述的这个错误: 错误:C2514:'QTimer':类没有构造函数。 我在 dialog.h 的私有(
我想使用 QTimer 用传感器值更新 GUI。 我尝试了以下非常简单的代码: from pyQt4 import QtCore def f(): try : print ("t
出于测试目的,我有一个简单的设置可以按时间间隔更改标签。似乎信号永远不会发出。我正在使用带有 Qt 插件的 Visual Studio 2010。这是我的设置... Window::Window(QW
我是 QT 的新手。我想弄清楚 QTimer 是如何工作的。我想在每次滴答时打印一些东西。但我无法让它工作。 测试对象.cpp: #include "testobj.h" #include #inc
我考虑过为回调提供额外的参数,但这看起来太复杂了(创建自己的修改后的 QTimer 对象等) 读完 QTimer docs 后我想到的另一件事正在保存 timerID 并检查它,但由于回调中没有任何内
我试图在不同的 QThread 中使用 QTimer,但我无法连接到 QTimer 的 timeout () 插槽。 我做错了什么? 这是我的代码: extern MainWindow *mainCl
这是我的情况: 我已经连接了以下内容: connect(timer, SIGNAL(timeout()), this, SLOT(avg())); timer->start(5000); avg()
我有以下类(class): class MainWindow : public QMainWindow { public: void StartTimer() { timer = new Q
这是我使用 QTimer 的方式: QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(upd
我试图让一个 QTimer 对象按时间间隔计数,连续调用一个函数。我遵循了一个例子,我已经设置了间隔,但它似乎并没有再次开始计数。 这是我正在使用的代码片段 QTimer *timer = new Q
我试图让 QTimer 运行,但它从未触发。我发现了一些关于计时器的其他问题,但问题始终是计时器超出范围。在我的小例子中情况并非如此: 我在自定义 QMainWindow 中创建计时器,这是 .h 文
我目前正在尝试制作蛇游戏以了解有关 QT 和 C++ 的更多信息,但是当我尝试自动移动我的 QGraphicsRectItem 项目时,它会改变速度。我的问题有没有更好的方法可以在没有 QTimer
我的程序消耗的 CPU 时间确实比我希望的要多得多(2 台显示器最多占用 80-90%)。我正在使用 Qtimers,其中一些时间短至 2 毫秒。在任何给定时间,我可以让每个显示器运行 12 个以上的
我是一名优秀的程序员,十分优秀!