【发布时间】:2012-11-13 18:59:23
【问题描述】:
当(且仅当)我退出我的应用程序时,这些(且仅这些)重复的消息会出现在命令提示符上:
QObject::startTimer: QTimer can only be used with threads started with QThread
QObject::startTimer: QTimer can only be used with threads started with QThread
QObject::startTimer: QTimer can only be used with threads started with QThread
这对我来说很奇怪,因为我从不在我的代码(或 QThread)中使用 QTimer。 事实上,使用该应用程序不会发生错误或崩溃,因此这实际上并不是真正的问题。 这在 Windows 和 Linux 操作系统中都会发生。
我所有的进口:
from __future__ import print_function
from PyQt4.QtGui import (QApplication, QMainWindow,
QFileSystemModel, QTreeView, QTableView,
QAbstractItemView, QMenu, QAction, QKeyEvent)
from PyQt4.QtCore import QDir, Qt, SIGNAL, QString, QFileInfo, QCoreApplication
import sys
主要功能:
def main():
app = QApplication(sys.argv)
app.setApplicationName("QFM")
app.setStyle("plastique")
gui = MainWindow()
gui.show()
app.exec_()
也许它可能与 QFileSystemWatcher(由 QFileSystemModel 使用)有关,我猜......也许它使用了一些 QTimer 功能。
【问题讨论】:
-
你能指出这些消息是在你的代码的哪一行引起的吗?
-
绝对不是,这2、3行重复的就是给我的唯一信息!!! :-|.
-
尝试添加一些控制台输出来查找导致代码行。
-
也许它来自您使用的库。尝试消除部分代码,直到问题消失。这应该会给你一些线索,问题出在哪里。
-
@user714965:没有 no 其他控制台输出,无法找到导致代码行。 JanneKarila:我添加了我的导入。因为应用程序还很小,所以我要去测试以前的版本,以找出问题开始出现的时刻。
标签: python pyqt4 multiplatform qtimer