Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qeventloop
    Log in to post
    • All categories
    • S

      Unsolved QEventLoop wait for a signal
      General and Desktop • qeventloop qtcpsocket • • Silent_Alex

      5
      0
      Votes
      5
      Posts
      496
      Views

      SGaist

      The issue is that you are handling the incoming data as if you would get full frames every time you receive something. There's no guarantee for that. Hence you should fix your buffer usage. Cumulate all the data until you know you have a full frame ready to be parsed further.

    • M

      Solved Some questions about local event loops
      General and Desktop • qeventloop loop events • • Merlino

      9
      0
      Votes
      9
      Posts
      1018
      Views

      M

      Thank you all for the valuable information you have given me!

      In the end I got around the inability to use the main event loop by running my new part on a separate thread, with this pattern:

      QThread myThread;
      MyNewPart newPart;
      newPart.moveToThread(&myThread);
      /* Connect(...) QThread::started -> MyNewPart::run*/
      myThread.start();

      Everything works without changing the code :)

    • T

      Unsolved Q Event Loop understanding
      QML and Qt Quick • event loop qml signal slot qeventloop • • texasRanger

      2
      0
      Votes
      2
      Posts
      223
      Views

      jsulm

      @texasRanger Why do you think you need an additional event loop? From your description I don't see any need for it. If file is changed you will get a signal from file watcher. You just need to make sure parsing of that file does not take too long.

    • D

      Unsolved QEventLoop - unique event?
      General and Desktop • qeventloop qevent • • Dariusz

      11
      0
      Votes
      11
      Posts
      430
      Views

      kshegunov

      @Dariusz said in QEventLoop - unique event?:

      well I have no idea how to solve it now...

      You said this is some kind of cumulative transformation you're doing, right? What about keeping only the info about the transform instead of actually doing it. Then on the update event you can calculate the accumulated result. Say you're moving a thing in space, you can keep the offset from the original position, you don't need to actually do to the move yet, just sum up the vectors. Finally construct the transformation matrix and apply. The same thing could be done for rotations, skews etc.
      The only thing that you need to be careful about, however, is that affine transforms aren't commutative. If you have move and then rotate, you can't invert the order to rotate and then move. Either way you can process the similar transformations in batches based on similarity.

      PS. I went on a limb here, as I have no clue what you're doing exactly. If you provide more info, we may end up suggesting something better.

    • D

      Unsolved Creating widgets in "another" thread...
      General and Desktop • qthread qeventloop qwidget parent • • Dariusz

      17
      0
      Votes
      17
      Posts
      6493
      Views

      JonB

      @Dariusz
      Sorry to make a post to just confirm what @SGaist has said above, but 20 * 75 == 1,500-odd line edits average. That's a lot! (And I pity the user who has to fill those in ;-) ) I think the suggestion that you look at the possibility of some kind of table instead needs reiterating. And @VRonin will then be here to ensure that you achieve this using item delegates instead of widgets in your table, so it will all be fast and not use up too much memory/resources ;-)

    • D

      Unsolved Pauses/stop QObjects inside QThread event loop
      General and Desktop • qobject qthread qeventloop • • Dariusz

      9
      0
      Votes
      9
      Posts
      559
      Views

      SGaist

      QObject has no event loop, the event loop is in QCoreApplication and siblings.

      You can not just stop the one from you main application. As for QThread you can interrupt the thread but I'm really not sure that's the best way to handle your situation.

      From the looks of it, you seem to have to create a queue of the events received and store these there while in pause mode and then empty that queue on restart if that makes sense.

    • C

      Unsolved Does QWebEnginePage::load() start a new event loop internally or it just calls processEvents() ?
      QtWebEngine • qwebenginepage qeventloop • • comy

      4
      1
      Votes
      4
      Posts
      449
      Views

      JonB

      @comy said in Does QWebEnginePage::load() start a new event loop internally or it just calls processEvents() ?:

      @JonB Starting a new local event loop is done by executing QEventLoop::exec().

      Oh I see, just QEventLoop::exec(). Yes, I had tried that. According to me it made no difference, and deleteLater()s of QWebEngine stuff still didn't free till execution got back to my top-level Qt event loop. Didn't understand why, your mileage may vary :)

    • D

      Unsolved QEvent, QEventLoop, batch process events?
      General and Desktop • qevent qeventloop • • Dariusz

      8
      0
      Votes
      8
      Posts
      343
      Views

      SGaist

      Even two if you take the QtScxml module.

      Well, I am not behind the design of the system so I can just offer some thoughts. I would say that if you need that level of control of the event loop, you might not be using the right tool for your use case.

    • D

      Unsolved QEventLoop instance for my "worker" to do work... - correct idea?
      General and Desktop • qeventloop qthread • • Dariusz

      16
      0
      Votes
      16
      Posts
      772
      Views

      D

      @Christian-Ehrlicher The thread don't get autodeleted once it runned its empty function? o.O I need to test it! :D

    • Phoenox

      Unsolved Nested QEventLoop
      General and Desktop • qeventloop qevent qapplication • • Phoenox

      2
      0
      Votes
      2
      Posts
      836
      Views

      Chris Kawa

      Events are not posted to a particular instance of an event loop object. They are posted to a thread. An event loop object does not "own" any events. It's basically a while loop that calls processEvents of a per thread event dispatcher.

      That being said if you nest event loops they all process the same pile of events. It's just that only the top one gets to do it while the calling ones wait for it to return.

    • R

      Solved Question to QEventLoop
      General and Desktop • qeventloop • • robro

      3
      0
      Votes
      3
      Posts
      391
      Views

      R

      Thank you very much! :-)

    • Y

      Unsolved can we use the Qtimer & QeventLoop in different thread?
      General and Desktop • qeventloop qtimer qthread • • Yash001

      8
      0
      Votes
      8
      Posts
      3988
      Views

      Y

      @Buckwheat Thank you documents link. I will read it and trying to make change in my code. thank you @Buckwheat .

    • Slane

      Unsolved QApplication in library project
      General and Desktop • library qapplication qeventloop • • Slane

      17
      0
      Votes
      17
      Posts
      3006
      Views

      Slane

      @SGaist I wish mean throw this message : QEventLoop: Cannot be used without QApplication

      But this problem is no more. I have delete the project and create un other without dll...
      It's not the best solution but it's gona work.

    • Q

      Strange behaviour of Signal/Slots (QtNetwork) used over QThread
      General and Desktop • qtnetwork qthread qeventloop signal & slot • • QtExchange

      8
      0
      Votes
      8
      Posts
      2792
      Views

      kshegunov

      @QtExchange
      Forgot to link those two, which are very important to understand before working with threads:
      QObjects' thread affinity: http://doc.qt.io/qt-5/qobject.html#thread-affinity
      Queued connections accros threads: http://doc.qt.io/qt-5/threads-qobject.html#signals-and-slots-across-threads

    • Svalorzen

      QEventLoop and qWait interaction
      General and Desktop • qtestlib qeventloop • • Svalorzen

      4
      0
      Votes
      4
      Posts
      1979
      Views

      SGaist

      You can find the implementation in qtestsystem.h

      It basically trigger event processing and sleeps a short time.

      Can you show a picture of how your system should work ?

    • MrDiv

      Solved QNetworkManager : resend qnetworkrequest before end make it crash
      Mobile and Embedded • qnetworkrequest qeventloop • • MrDiv

      3
      0
      Votes
      3
      Posts
      1154
      Views

      SGaist

      Hi and welcome to devnet,

      That's because you are calling exec on _eventLoop twice. You should rather use a local QEventLoop or not allow the query to start if already in progress.

    • Q

      Solved Run multiple QEventLoops in parallel (for QtNetwork)
      General and Desktop • qtnetwork qeventloop parallel • • QtExchange

      6
      0
      Votes
      6
      Posts
      2082
      Views

      jsulm

      I never tried to start a thread with event loop in a program without main event loop (QApplication). My guess: it will work inside your thread, but you will not be able to communicate with the thread from main thread using signals/slots.

    • S

      [SOLVED] Threaded QTcpServer Multiple QSslSocket clients with QDataStream readyread() sometimes not emitted
      General and Desktop • qdatastream qthread qtcpserver qsslsocket qeventloop qmysql • • SebastianS

      2
      0
      Votes
      2
      Posts
      1723
      Views

      S

      Ok guy thank you for that much replies :P! I solved the issue by myself anyway. In case sombebody has a similar problem here comes the solution:

      What I did wrong was that I connected a time consuming function to the UpdateClient::tcpReady() slot. In this function I did some stuff which also lead to the emission of UpdateClient::tcpReady(). This broke the QEventQueue. So to what I had to chance was to skip the direct signal slot connection an do this in the UpdateClient::tcpReady():

      QTimer::singleShot(0, this, SIGNAL(updateAvailable()));

      No everything is working fine ;).

    • S

      [SOLVED]Delay function leads to Exception in new thread
      General and Desktop • delay exception threads qcoreapplicatio qeventloop • • Sen Li

      6
      0
      Votes
      6
      Posts
      5421
      Views

      S

      @ChrisW67

      Thank you for you help.
      Probably the thing is, QSerialPort has a problem to work in a new thread.

      I can handle the other QObject in a new thread very well, and the exception only happens when the Object contains QSerialPort.
      Also, in my last post, I actually never user QList, although Qt tells me something wrong with QList.

      I have given up on working serialThread. QSerialPort does work good in the main thread.

    • L

      Custom Synchronous Message Dialog with QEventLoop
      General and Desktop • synchronous qeventloop • • Leonardo

      3
      0
      Votes
      3
      Posts
      1224
      Views

      L

      @SGaist Hi. Thank you for your help. I'll give it a try, but I still don't get why my code doesn't work... If anyone could take a guess, I'd appreciate.