Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qtimer
    Log in to post

    • SOLVED The current process has used all of its system allowance of handles for Window Manager objects.
      General and Desktop • windows qtimer qtimer failed • • koahnig  

      2
      0
      Votes
      2
      Posts
      91
      Views

      OK, it was a bit premature to ask immediately. I found this post https://forum.qt.io/topic/54438/solved-qt-5-4-1-qtimer-using-up-all-handles-for-window-manager-objects Actually with QNetworkAccessManager I was a bit sloppy. Need to check if it helps already. Edit[koahnig]: It helped. Therefore, pay attention when generating new QNetworkAccessManger objects.
    • UNSOLVED QTcpSocket Write
      General and Desktop • qt5 qthread qtcpsocket qtimer • • duckrae  

      8
      0
      Votes
      8
      Posts
      96
      Views

      @duckrae List your client with id, when you are getting new incomingConnection. server can reply as per client id to a specific client or reply to all.
    • UNSOLVED How do I make a QLabel Blink?
      General and Desktop • windows 10 qlabel qtimer mainwindow qt6.1.2 • • DougyDrumz2  

      5
      0
      Votes
      5
      Posts
      154
      Views

      @DougyDrumz2 said in How do I make a QLabel Blink?: The consensus is evidently to l hide and show a QLabel Not my "consensus :) So far as I am aware, hiding can cause different layout redraw in at least some circumstances. I retain visibility but toggle foreground color to QColor(Qt::transparent) or toggle alpha color value between 255 (opaque) and 0 (transparent) on palette QPalette::setColor(QPalette::Text, colour). Also, creating multiple QTimer::singleShot()s doesn't scale very well if you want to change the number of flashes or the interval between. Or of you have multiple labels to blink and you'd like them all to be "in sync". I use one regular repeating QTimer with a "countdown" and cancellation when it reaches 0. Up to you on both of these.
    • UNSOLVED How to write another Thread data in txt file?
      General and Desktop • c++ qt5 qthread qtimer • • duckrae  

      4
      0
      Votes
      4
      Posts
      107
      Views

      @duckrae said in How to write another Thread data in txt file?: How can I handle it? Simply emit the signal: QTimer *timer = new QTimer(this) timer->start(60000); emit myTimeoutSignal(text);
    • UNSOLVED What does "of" when used with QOverload do?
      C++ Gurus • qtimer qoverload qof • • ActivateTheDroids  

      3
      0
      Votes
      3
      Posts
      113
      Views

      @ActivateTheDroids said in What does "of" when used with QOverload do?: why is of there? Because of limitations in C++11. If you have C++14 support, then you don't need of: https://doc.qt.io/qt-5/signalsandslots-syntaxes.html#selecting-overloaded-signals-and-slots
    • SOLVED QTimer & Thread, adding it to running thread...
      General and Desktop • qthread qtimer • • Dariusz  

      5
      0
      Votes
      5
      Posts
      181
      Views

      @SGaist said in QTimer & Thread, adding it to running thread...: With only bits of your code it's not possible to understand your implementation and the possible issues you might be facing. Today is special day for my brain and I literally fail at basics... I forgot to start the worker... thus its event loop never run... thus it never started the damn timmer... ehhh!!!! Everything works fine once I started the worker... yayyyy I learned something new! :- )
    • UNSOLVED Avoid dangling QTimer object
      General and Desktop • qtimer stop • • hbatalha  

      12
      0
      Votes
      12
      Posts
      368
      Views

      Both QTimer timer and QTimer * timer{} are ok. The only difference is QTimer header file is included or not in the class header file. This is not an issue. If C++ is used, new and delete is not a problem. You do it all day long.
    • UNSOLVED Warning: QObject::startTimer: Timers can only be used with threads started with QThread
      General and Desktop • qthread qtimer shared library static library qt 5.12 • • adw0022  

      2
      0
      Votes
      2
      Posts
      784
      Views

      Install a Qt message handler, set a breakpoint in there and take a look at the backtrace where it comes from.
    • UNSOLVED Display text for 4 seconds
      General and Desktop • qtimer • • User123456  

      15
      0
      Votes
      15
      Posts
      780
      Views

      @User123456 said in Display text for 4 seconds: @JonB, I am using an old version, 4.5. I cannot just upgrade it since it is part of the requirements. Could you please give an example which will work on that version? Given that you appear to be a beginner, I am surprised you are using such an old version of Qt. That must mean you have an existing, pretty ancient Qt code base to work with. I understand it's not automatic/trivial to upgrade, but it's shame. If you post any future questions in this forum you should state each time that you are using Qt4, as it may be relevant to answers. Bear in mind when looking through documentation/examples you may need to check for Qt 4 ones/compatibility. Anyway, with an explicit method and not a lambda: // header file: private slots: void onTimeout(); // cpp file: void Dialog::onTimeout() { ui->LabelMessage->setText(""); } // caller: // next line connects using *new style* syntax, which is nicer... QTimer::singleShot(4000, this, &Dialog::onTimeout); // ... but if that doesn't work in Qt4 you can use *old style* syntax QTimer::singleShot(4000, this, SLOT(onTimeout()));
    • SOLVED Using QTimer::singleShot correctly for updating messages on GUI
      General and Desktop • qtcreator qlabel qtimer • • TUStudi  

      8
      0
      Votes
      8
      Posts
      604
      Views

      @TUStudi said: I actually have 6 QLabels, so I now have 6 timer and so on Derive a class from QLabel and add that functionality to it. Don't write the same code 6 times! My QLabels have the sizePolicy horizontal: preferred and vertical: fixed and a vertical length of 20. When a text is displayed, the QLabel expands so that the elements above the QLabel are also moved upwards and after the text disappears, they go back to their initial place. Fixed size policy means that widget uses its sizeHint() as the size. If you change the text the size hint also changes, so label grows/shrinks.
    • UNSOLVED QTimers and QThreads
      General and Desktop • qthread qtimer can bus • • TMJJ001  

      2
      0
      Votes
      2
      Posts
      183
      Views

      @TMJJ001 said in QTimers and QThreads: connect(&cThread,SIGNAL(started()),this,SLOT(DoWork())); You do NOT execute DoWork() in that thread, you execute it in the GUI thread. Take a closer look at the example here: https://doc.qt.io/qt-5/qthread.html
    • UNSOLVED Render QGraphicsView into video file problem
      General and Desktop • qt3d qtimer qgraphics • • hamed_ta  

      2
      0
      Votes
      2
      Posts
      178
      Views

      opencv (extra characters to make response longer than 8 characters...lame!)
    • SOLVED How to create some Timers at run time and handle them?
      General and Desktop • qtimer • • Jamshid  

      19
      0
      Votes
      19
      Posts
      1166
      Views

      Thank you all dear friends, that’s really kind of you. Your help is so appreciated.
    • SOLVED Start QTimer from another thread in event() function? Or other delay ?
      General and Desktop • qthread qtimer qevent qtimer arm linu • • Dariusz  

      6
      0
      Votes
      6
      Posts
      1120
      Views

      You're welcome ! Since you have it working now, please mark the thread as solved using the "Topic Tools" button so other forum users may know a solution has been found :-) Seems the cache hid the fact that you did everything already !
    • SOLVED Is it necessary to restart a timer with a timeout() signal set at constant intervals?
      General and Desktop • qtimer qtime • • The178  

      9
      0
      Votes
      9
      Posts
      986
      Views

      @The178 Hi On your first post
    • SOLVED Understanding setInterval(int msec) function
      General and Desktop • qtimer interval • • The178  

      5
      0
      Votes
      5
      Posts
      458
      Views

      @Kent-Dorfman that was my bad, the actual name in the code is different (I didn't want to use the original since it could potentially disclose information I am not allowed to share) and I wasn't creative enough to think of something so I said timer1 haha. The actual variable is all letters :).
    • SOLVED How can I set timer in order to change the picture in the label in Qt
      General and Desktop • qt5.5 qpixmap qtimer timer • • greencow  

      5
      0
      Votes
      5
      Posts
      1448
      Views

      @dheerendra Okay, done, thank you for reminding!
    • UNSOLVED What's the fastest way to show JPG/JPEG images
      General and Desktop • qlabel qtimer streaming • • R_Irudezu  

      18
      0
      Votes
      18
      Posts
      4162
      Views

      Why are they not ?
    • UNSOLVED can we use the Qtimer & QeventLoop in different thread?
      General and Desktop • qthread qtimer qeventloop • • Yash001  

      8
      0
      Votes
      8
      Posts
      3718
      Views

      @Buckwheat Thank you documents link. I will read it and trying to make change in my code. thank you @Buckwheat .
    • UNSOLVED Help Please! Signals & Slots: When objects destroyed
      General and Desktop • qobject qtimer signals & slots • • scottnat  

      3
      0
      Votes
      3
      Posts
      3588
      Views

      void MainWindow::doThat() { // private: int m_numDestroyed; m_numDestroyed = 0; for(QTimer*& singleTim : {timerA ,timerB ,timerC }){ singleTim = new QTimer(this); singleTim ->setInterval(100); singleTim->setSingleShot(true); } const auto checkDestroyed=[=]()->void{ if(++m_numDestroyed>1){ delete numDestroyed; timerC->start(); }; connect(timerA,&QTimer::timeout,this,[=]()->void{ qDebug("slot A"); checkDestroyed(); } }); connect(timerB,&QTimer::timeout,this,[=]()->void{ qDebug("slot B"); checkDestroyed(); } }); connect(timerC,&QTimer::timeout,this,[=]()->void{ qDebug("slot C"); } }); connect(timerA,&QTimer::timeout,timerA,&QTimer::deleteLater); connect(timerB,&QTimer::timeout,timerB,&QTimer::deleteLater); timerA->start(); timerB->start(); }
    • UNSOLVED Why don't the signals emit from QThread ?
      Language Bindings • qthread signal & slot pyqt5 qtimer signals emit • • daegontaven  

      23
      0
      Votes
      23
      Posts
      9075
      Views

      @SGaist I need the slot send_console_log to be called when the signal written in ConsoleStream is emitted. When running the program with a normal while/for loop in the interpreter, the slot will be called becuase at that moment its non blocking. But the moment I add time.sleep into a loop, slots will only be called at the end when all the blocking is over. Thank you for looking into this.
    • UNSOLVED QGraphicsScene taking long to update
      General and Desktop • qgraphicsview pyside qtimer qgraphicswidget • • martinvej  

      7
      0
      Votes
      7
      Posts
      2416
      Views

      @SGaist Thanks for suggesting OpenGL, I think that might be a possibility at some point. As of now, I got it to work by locking the UI updates and batch repainting all of the windows at once: for(auto widget : qApp->topLevelWidgets()){ widget->setUpdatesEnabled(true); } qApp->processEvents(); for(auto widget : qApp->topLevelWidgets()){ widget->setUpdatesEnabled(false); } I know this may not be the best way to achieve this, so I am all ears if there's any better way to limit UI updates to a single point in execution. Thanks!
    • SOLVED Delete message after x seconds
      General and Desktop • qtimer label remove text • • QT-static-prgm  

      25
      0
      Votes
      25
      Posts
      6994
      Views

      @mrjj as i told you in the thread, it looks the same as on your picture. But it should be transparent, so you can see the code lines from the editor below in your case. But let's continue that in the other thread
    • SOLVED SerialPort in a different Thread
      General and Desktop • qthread qtimer serial port • • J.Hilk  

      2
      0
      Votes
      2
      Posts
      1083
      Views

      Never mind, I had code in my the constructor of the to be threaded class, that caused the conflict... connect(&modbusThread, &QThread::started, modbusDevice, &Modbus::setupClass); fixed the issue.
    • UNSOLVED Launching Gnome Terminal Stop QTimer
      General and Desktop • c++ qtimer gnome • • DougyDrumz  

      6
      0
      Votes
      6
      Posts
      1330
      Views

      QProcess that is.
    • SOLVED QTimer::singleShot - forward parameter to SLOT called
      General and Desktop • qtimer • • McLion  

      16
      0
      Votes
      16
      Posts
      19773
      Views

      @VRonin Yep - you're absolutely right. It's unfinished code and currently a draft to start off with a ID range of 1 as a proof of concept. Will take you input into account - Thanks a lot!
    • SOLVED QFtp & QTimer timeout on connectToHost issues (Qt 5.5.1 Win32 VS2013)
      General and Desktop • qtimer qt 5.5.1 qftp • • qDebug  

      12
      0
      Votes
      12
      Posts
      5109
      Views

      My bad, from your last post, I understood that you replaced the deleteLater call by a new allocation. Why are you calling delete right after deleteLater ?
    • UNSOLVED QTimer from a non QThread
      General and Desktop • qthread qtimer main • • slilly  

      3
      0
      Votes
      3
      Posts
      1342
      Views

      @slilly said: Can QTimer be called from a normal C++ main and not a QThread or a main using a QCoreApplication? No. If you want to use QTimer, then you need QCoreApplication::exec() or QThread::exec().
    • SOLVED QTimer Pointer Out of Scope?
      General and Desktop • qt4 qtimer qprogressdialog • • DougyDrumz  

      4
      0
      Votes
      4
      Posts
      1366
      Views

      @DougyDrumz Easy peasy ... no one seems to want to answer my questions though. ;) Happy coding!
    • SOLVED How to disable connection timer in QTcpSocket
      General and Desktop • qtcpsocket qtimer networking • • YuriQ  

      3
      0
      Votes
      3
      Posts
      1886
      Views

      @SGaist you should have to modify QAbtractSocket Seems like you right. The code in 'qabstractsocket.cpp': <...skipped...> // Start the connect timer. if (threadData->hasEventDispatcher()) { if (!connectTimer) { connectTimer = new QTimer(q); QObject::connect(connectTimer, SIGNAL(timeout()), q, SLOT(_q_abortConnectionAttempt()), Qt::DirectConnection); } connectTimer->start(QT_CONNECT_TIMEOUT); } <...skipped...> And there are no options to disable it. But I think it will be easy to patch it to make it work without connectTimer. But use a single timeout for thought of sockets ? Sounds strange. What else can I do to avoid handles exhaustion? I don't see any other options. Out of curiosity, why do you need so many sockets ? Just testing Qt abilities and limitations in this particular area.
    • SOLVED terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
      General and Desktop • qtimer memory allocators • • ForestPoem  

      3
      0
      Votes
      3
      Posts
      4060
      Views

      @ForestPoem said: nArray thanks. nArray = arrayNum It's my mistake. The two are the same
    • SOLVED QVector / QList проблем при използването им със потребителски класове
      Bulgarian • qtimer connect qcoreapplicatio qtservice • • pecuna91  

      27
      0
      Votes
      27
      Posts
      8126
      Views

      @Stoyan error: passing 'const Operation' as 'this' argument of 'int Operation::setAttribute(QString, QString)' discards qualifiers [-fpermissive] operations.at(i).setAttribute(Aname,Value); Не мога да разбера защо се получава това съобщение в Task класа, опитвайки се да извикам метода SetAttribute за операция във вектора. Const Operation не знам откъде идва вътре в тази функция конкретно, след като подавам само id-то на операцията. Подобна е грешката и при Task сетване на атрибут: scheduledtopservice\scheduler.cpp:31: error: passing 'const Task' as 'this' argument of 'int Task::setAttribute(QString, QString)' discards qualifiers [-fpermissive] tasks.at(k).setAttribute("state","running"); ПП: Успях да го реша проблема. Разбрах че .at() връща const обект, затова използвах [i] за индекс. task.cpp:17: warning: base class 'class BaseObject' should be explicitly initialized in the copy constructor [-Wextra] Task::Task(const Task &obj) Това как мога да го оправя, четох че създавало още 1 копие на BaseObject така. Но не е като експлицитния конструктор сякаш : BaseObject ( const BaseObject &obj) ако долепя до Copy конструктора на Task. Не съм сигурен, но май просто като сложих : BaseObject() и се изчисти предупреждението. Така ли трябвa да бъде ?
    • Problem with QTimer and QtCore
      General and Desktop • qtimer libraries qtcore • • axel_av  

      3
      0
      Votes
      3
      Posts
      1174
      Views

      Hi and welcome to devnet, In addition to @mrjj, can you show the exact error you have ?
    • How to call drawBackground function after timeout of QTimer [SOLVED]
      General and Desktop • qtimer call drawbackgound • • nanoandrew4  

      6
      0
      Votes
      6
      Posts
      1447
      Views

      You're welcome ! An outside look from time to time can give some good ideas :)
    • QTimer
      QML and Qt Quick • qtimer • • diredko  

      5
      0
      Votes
      5
      Posts
      1318
      Views

      @herick5566 What is the issue are you facing ? Are you not able to stop the timer after some specific number of times ? Let us know the issue faced by you.
    • Longtime stability of QTimer events
      General and Desktop • qtimer qtimer stabilit • • koahnig  

      5
      0
      Votes
      5
      Posts
      2029
      Views

      @Wieland Thanks for the lead, I will do some more investigations then.
    • QTimer and remainingTime()
      General and Desktop • qtimer remainingtime qtbug-46940 • • koahnig  

      10
      0
      Votes
      10
      Posts
      6197
      Views

      @koahnig you are great!
    • [Solved] What are the odds that a QTimer or an event loop is being stopped?
      General and Desktop • qtimer event loop • • koahnig  

      10
      0
      Votes
      10
      Posts
      3588
      Views

      I have found the problem. It was a blocking ftp download which did not finish because of broken communication. Pushing the download to a separate thread unveiled the problem respectively made it tracable.
    • [SOLVED] QTimer in mainwindow class
      General and Desktop • qtimer • • Duncan  

      2
      0
      Votes
      2
      Posts
      1317
      Views

      Forgot to add the #include <QTimer> in the mainwindow.h file :)
    • QTimer and QLCDNumber not working correctly together.
      General and Desktop • qtimer timer qlcdnumber • • Jorge  

      4
      0
      Votes
      4
      Posts
      1994
      Views

      When does it start to show that A ?