347 questions
0
votes
0
answers
42
views
Cannot restart a QTimer timer after stopping it from a python script
I'm running a QWidget in python using an extended version of the following code:
class MyWidget(QWidget):
def __init__(self):
super().__init__()
self.timer = QTimer(self)
...
1
vote
0
answers
109
views
QThread msleep() vs. QTimer in PyQt5: Key Differences, Best Practices, and Use Cases [duplicate]
I am working on a PyQt5 application where I need to perform periodic tasks. I've come across two primary approaches:
Using time.sleep() or QThread.msleep() in a subclass of QThread.
Using QTimer.
...
-1
votes
1
answer
296
views
PyQt6 app with QTimer is much slower on Windows then the same machine's WSL
I'm developing a PyQt6 app that plots data from a measurement instrument and something else related to user input, and I'm experiencing outstanding lags when I run it on Windows vs on the WSL (Windows ...
0
votes
0
answers
44
views
Usage of Single timer for multiple triggers among various popups
I have 5 different popup's that displays 5 different properties all these 5 properties need to be checked periodically from CPP in order to update if there is any change in the value of property. At ...
0
votes
1
answer
177
views
PyQt6 application auto-closes unexpectedly without leaving any error message
I'm developing a PyQt6 application that deals with real-time acquisition of photon intensity tracking over time and plots it in real-time, before calling a pyo3 function for post-processing on the ...
0
votes
1
answer
153
views
QTimer is not triggered immediately after completing Blocking task
Background:
In our Embedded QT application(based on ARM processor), there is a Qtimer which will timeout for every 20ms.
Updating the user interface objects is done inside the timeout handler of this ...
0
votes
1
answer
143
views
write() is faster than read() in TCP Connection using Qt C++
I am experiencing issues where block of data written into a socket within a QTimer in a server application ,which can't be read by the client completely because the client's read process is slow, so ...
0
votes
1
answer
138
views
When there are multiple QTimers in the same QThread, why are the tasks associated with the QTimer executed serially?
I'm trying to run multiple timers in one QThread, I expect each timer to be independent.
But the final running result is not what I expected. All timers seem to be executed serially.
For example, in ...
4
votes
0
answers
139
views
Segmentation fault while creating QTextEdit
I wrote a minimal example in which my application crashes. I can't figure out what's wrong. I hope someone has thoughts about the reason for this segfault.
if you increase the QTimer timeout, for ...
-2
votes
1
answer
209
views
Use of Qtimer before event loop started
I have created a simple, single thread, app in Qt6. My sole class creates a couple of timers and prints a qDebug message in the timeout slot. These messages never print.
My class is created before ...
0
votes
1
answer
63
views
Why does pyqt subthread freezes GUI when doing heavy repetitive work?
In this simulated example I am repeating a task every 1 second using QTimer by implementing a QObject, then move it to a QThead. The simulated task takes 0.5 second. The task runs in a new thread, ...
3
votes
1
answer
582
views
How to create a QTimer that runs independent of the main thread
I’m working on a QT QML and embedded STM32 project where an oven is being controlled by a PC via serial communications. Everything was going great until I tried to add a timed heartbeat signal to let ...
0
votes
1
answer
264
views
How to interrupt the execution of a function in C++/Qt
I'm working on implementing a "tutorial mode" on a software that uses C++ and Qt. To this end, I need to rotate a GL view to show the user that it can move. In order to do a smooth rotation, ...
-1
votes
1
answer
136
views
How to combine QTimer with QThreadPool to get real-time?
I am trying to put a QTimer inside a QThreadPool.
The reason is that I need to count real-time since the start of a process (recording video), but the actual code seems to be lagging a bit and the ...
0
votes
1
answer
359
views
How much resource heavy are the timers?
Suppose a timer is fired every 1 second to execute some task, which is not CPU intensive.
What is the resource heaviness of a timer itself?
Related to C# perspective: How resource heavy is a Timer?
[...
0
votes
0
answers
715
views
How to stop a QTimer from within its timeout event? [duplicate]
I have a QTimer to do stuff at intervals. Sometimes, this stuff raises an exception. When that happens, I must stop the QTimer without destroying it, so I can restart it later on. However, when I ...
2
votes
0
answers
187
views
PyQt5 QTimer 10ms is not accurate with QEventLoop and qasync in GUI APP
there:
I have a weird behaviour with QTimer in PyQT5 when I try to measure frames and frequency. If you set a timer with 10ms = 1 / 100 every signal message gives the time every time. It works with ...
0
votes
0
answers
83
views
How can I figure out which QTimer is producing the message "Timers cannot be stopped from another thread"?
I'm working on a Qt app that creates a lot of threads and QTimers. When it exits, I get the following message printed:
2022-09-27 13:40:22.123 QObject::killTimer: Timers cannot be stopped from another ...
1
vote
1
answer
1k
views
PySide2 how to use Qtimer like time.sleep
I have a simple GUI App, it's a timer with LCD display I have problem with delaying one function that's responsible for counting down the time it's should count down every second, but it's count the ...
1
vote
1
answer
892
views
Is a QTimer in a background thread updated even if the main thread is busy?
Let's say I have a PyQt GUI application and a QTimer running in the background using a QThread. The QTimer is set to an interval of 1 second and is running infinitely.
Now the main thread gets busy ...
0
votes
1
answer
670
views
PyQt5 Qtimer don't start
i'm stucked on a Qtimer that don't start, so the number that i need to update on the GUI is never showed.
i don't want to use a while loop inside the code because i need to change some values in real ...
1
vote
2
answers
793
views
How to use a QTimer only after a QThread is started
I would like to use a QTimer in my MainWindow application. The timer should start when the thread is started. I have tried:
ct_thread.h
#include <QtCore>
#include <QThread>
#include <...
1
vote
2
answers
518
views
How to use QElapsedTimer without a QTimer?
When I tried to use QElapsedTimer to clear a text in a label I couldn't find a way of using it without a QTimer. Is there a way of connecting a method so that it will do something when the ...
0
votes
0
answers
406
views
PyQt6 Label is not updating with every iteration of for loop
I'm a beginner in programming and I have a problem making a label on my GUI to change its text value to inform the user of word's meaning (working on English dictionary). I would like the label to ...
2
votes
1
answer
1k
views
Reset or reinitialize a PyQt singleShot Timer to prevent function call
Is there a wy to reset a singleshot Timer?
I set the singleShot timer to 5000ms and want to reset the timer by clicking a button so the timer starts again to count.
from PyQt5 import QtCore
from ...
2
votes
1
answer
3k
views
PyQt6: Use QTimer to run a loop for a few seconds before stopping
I want to run a python while-loop for x amount of time (2 seconds) and then stop:
from PyQt6 import QtCore
def loop():
stop = False
def stop_loop():
nonlocal stop
stop = True
...
1
vote
1
answer
1k
views
Timer delay in round proress bar of PYQt5
In PYQT5, I want to increase the progress of the round progress bar in UI after every 10 minutes by using PyQt5 for 90 minutes.
I have tried 2 methods 1st by time.sleep() and 2nd by Qtimer.
1st method ...
1
vote
1
answer
2k
views
Using a QTimer within a PyQt worker thread
I am working with serial device and set a flag (which is global variable) based on the received data. Now I want to reset the flag after a while (for example one second) by using a timer.
Here is the ...
2
votes
1
answer
5k
views
Connect QTimer with a Slot with parameters [duplicate]
I tried the following:
connext(&timer, &QTimer::timeout, this, &myClass::myMethod(_param1, _param2)); // does not work
timer.setSingleShot(true);
timer.start(100);
The timer of type ...
0
votes
1
answer
72
views
Preventing the timer from updating the counter variable for more than once
I have a qt application with cpp. The application is Falling ball game, when the ball is catched by basket the score needs to be incremented.
The application uses some timerEvent to update the score. ...
0
votes
1
answer
287
views
PyQt5 QTimer in not working after moving it to a thread
I am currently trying to separate my PyQT5-GUI from my serial communication to prevent a freezing GUI.
Therefore, I tried to implement threading. So when I am pressing a button "Open Port", ...
0
votes
1
answer
238
views
QTimer format converting
I have this code:
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt, QTimer
import sys
class Ui_Timer15(object):
def setupUi(self, Timer):
Timer.setObjectName("...
0
votes
0
answers
526
views
OpenCV Timers cannot be stopped from another thread
I have a problem with opencv 2.4 when run on linux arm.
I don't use timer in my code but when it get error Timers cannot be stopped from another thread
My code
void displayImage(const unsigned char *...
0
votes
1
answer
218
views
How can I find from which key the timeout signal sent from Qtimer objects in Qmap comes from?
In a function, how to understand the signal sent from Qtimer objects that I created in Qmap, how to find from which object the signal comes from in the slot function.
I created Qmap above code
SQL.h
...
0
votes
1
answer
123
views
errors whan using QTimer in a multithreading application
I am starting a api rest server in a separate Qthread in my application.
the server shall use a library which is using Q timer in several places.
The compilation is ok. But i have errors in execution....
0
votes
1
answer
95
views
Creating separate timer for speed and ball creating
I am working on Falling ball application,
About the application: the balls keep on falling at regular intervals, and there is a basket that catches the balls. If caught then we earn a point if not ...
0
votes
0
answers
98
views
How to run the code between specific dates on QT
How can I run the function I want in the code in the time interval I selected in the code I wrote in Qt? How can I set up a signal slot structure? can you show sample code?
for example in the code I ...
0
votes
1
answer
956
views
QEventLoop in QTimer slot
I have multiple QTimer in the same thread, in the slot connected to the QTimer, I use QEventLoop for synchronization, like http requests, but I found different QTimers may affect each other when they ...
0
votes
1
answer
844
views
PyQt5 Automatically update curent time in subthread
I want to automatically update the current time in Qstatusbar. I used mainUI thread for displaying time and subthreads for other long-running tasks. This is working fine.
Now, I would like to use the ...
1
vote
0
answers
116
views
QProgressbar does not respond to large values
I want to build an application that calculates large computations using an idle timer. The progress bar works fine for small numbers but if I enter large numbers as input the progress bar does not ...
1
vote
1
answer
937
views
How to make a QTimer as Idle timer in qt using CPP
I am new to Qt programming, I want to make the timer an idle timer.
The question is whether just setting the timer->start(0) will make the timer an idle timer?
How can I know it's an idle timer.
0
votes
1
answer
937
views
stopping a Qthread with a QTimer
I am starting a Qthread in my GUI to perform an optimization function. I want to include a stopping function that can interrupt the Qthread, and end the optimization function immediately.
I read that ...
2
votes
1
answer
899
views
Problems getting QTimer to start when using QThread
I'm trying to implement a webcam using PyQt5 from an example I found (here, but not really relevant).
Getting the example to work wasn't an issue, but I wanted to modify some things and I am stuck on ...
0
votes
2
answers
1k
views
Why is QWidget being destroyed? (PyQt)
So I have the main window. When I click a button in the main window, a new widget is created (in a new window):
self.doorButton.clicked.connect(self.open_door)
def open_door(self):
...
0
votes
1
answer
87
views
simulating the non-blocking cpu_percent using pyqt5 QTimer
I am trying to show the cpu_percent of a process (p) using p.cpu_percent(). If I use the block (interval=2), the GUI hangs out, but If I use non-block (interval=None), the first call is always (0%). ...
0
votes
1
answer
134
views
How to call method in gui (application) thread from method in non-gui thread?
I have a potentially long-running task (serialise a document) which I don't want to run in the Gui thread. At the end of that task I want to update various visual aspects of the UI (menu enablement, ...
2
votes
1
answer
2k
views
Problem with QTimer() function in PySide6 the function doesn't loop [duplicate]
I have this PySide app and I want to run the function pp every 1 second, but when I run the app it only ran for 1 time.
import sys
from PySide6.QtWidgets import QMainWindow, QApplication
from PySide6 ...
0
votes
0
answers
151
views
Pyqt5: How to timeout Qtimer in QTread?
**I want to design a timer that uses a flag to trigger the timer, and then start the timer count or stop the timer count. I tried some methods to fix it, but it was not triggered. Can someone help me ...
0
votes
1
answer
243
views
How Use QTimer Command
I have a problem in using QTimer command.
I dont have any syntax error, but i have 2 error in qglobal.h and qobjectdefs_impl.h and i dont understand them.
MainWindow.cpp
MainWindow::MainWindow(...
0
votes
1
answer
758
views
Qt C++ Timer inside a QThread and send data from QThread to GUI Thread
I created a timer in a thread and in this timer char value counts from 0 to 10.
I want to display this char value on the GUI. I do not get any error but the GUI freeze when I started.
Can you help me ...