Qt Forum

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

      Unsolved Threading a Qt6 fullscreen image
      Qt for Python • python threading splashscreen • • mullman1

      5
      0
      Votes
      5
      Posts
      297
      Views

      S

      You can pre-compute the BMP in a separate thread and then access the finished image in the main thread to use it in the splash screen.

    • M

      Unsolved GUI Freeze on Multi-Thread Application
      General and Desktop • threading serial port database multi-thread freeze • • mvsri

      5
      0
      Votes
      5
      Posts
      355
      Views

      SGaist

      Hi,

      What kind of popup are triggering the freeze ?

    • S

      Unsolved Not to freeze the main window while running a loop of threads
      General and Desktop • qthread thread threads threading • • sylvalas

      3
      0
      Votes
      3
      Posts
      123
      Views

      SGaist

      Hi,

      In addition to @Christian-Ehrlicher, what exactly are you trying to achieve ?

    • G

      Running QApplication::exec() from another thread (QCoreApplication, QGuiApplication)
      General and Desktop • pyside6 threading • • gd2shoe

      2
      2
      Votes
      2
      Posts
      1513
      Views

      JKSH

      @gd2shoe Thank you for this detailed, comprehensive, and correct post!

      As far as I can see, everything you've written is correct. I can't see anything important that you've left out.

      the Qt "main thread" is the first thread to create a QObject instance.

      ...

      Only one QCoreApplication instance can be created at a time (or it's derivatives). It should be created in the Qt "main thread" (which should also be its thread affinity). Its exec() function starts the main event loop, and should be run from the Qt "main thread".

      Bingo. These are the core points from which everything else derives from.

      There is one more implication: If we want to destroy the QCoreApplication and create another one (without unloading the libraries from the process' memory), then we must keep the original "main thread" alive and create the new QCoreApplication in that same thread. Shutting down the original "main thread" means that we cannot create any more QCoreApplications in this process instance.

      Currently, the formal documentation is incomplete, and somewhat inaccurate/misleading. Hopefully that will be rectified at some point.

      Would you like to have a go at correcting it? (Both the documentation and the runtime warning, "WARNING: QApplication was not created in the main() thread.")

    • R

      Unsolved error: QThread no member named create
      General and Desktop • qthread threading multi-thread • • rtvideo

      9
      0
      Votes
      9
      Posts
      650
      Views

      SGaist

      That question is being answered on this thread.

    • L

      Unsolved Signal inside readyread of QUdpsocket
      General and Desktop • signal & slot threading udp qudpsocket • • Lior

      7
      0
      Votes
      7
      Posts
      409
      Views

      Christian Ehrlicher

      @Lior said in Signal inside readyread of QUdpsocket:

      why the UI main thread stoped to respond ? the msleep is in anthor thread.

      Because you do it wrong (and I would guess the msleep is not in the thread but in the gui thread) but without code...

    • VikramSamy

      Unsolved UI Resposiveness + Multithreaded TCP server-client (UI lags, slow, less responsiveness when 2 client connected)
      General and Desktop • reponsiveness lagging threading • • VikramSamy

      14
      0
      Votes
      14
      Posts
      1539
      Views

      SGaist

      Rather than having both your PLCs competing to write in some global structure. You should rather have them independently fill each their own structure and have some sort off watchdog switching from one or the other if needed.

      Depending on the how often the PLC are supposed to send data, you should maybe consider restarting the network check when you receive data rather than having that again competing with incoming data.

    • Y

      Unsolved QML Camera initialisation in background ?
      QML and Qt Quick • camera qml threading • • YenZi

      2
      1
      Votes
      2
      Posts
      639
      Views

      Diracsbracket

      Hi @YenZi
      A little bit late, but could using a Loader and settings its asynchronous property to true work?
      http://doc.qt.io/qt-5/qml-qtquick-loader.html#asynchronous-prop

    • A

      Unsolved QWebSocket and Synchronous Response/Request Cycle
      General and Desktop • qwebsocket asynchronous synchronous threading • • ad7000

      7
      0
      Votes
      7
      Posts
      1687
      Views

      A

      @jsulm It's alright. I ended up going completely asynchronous by using a chained callback structure. Thanks anyways for the help!

    • X

      Unsolved How to run a thread again?
      General and Desktop • thread ui object threading threads • • xLlama

      4
      0
      Votes
      4
      Posts
      1842
      Views

      SGaist

      Hi,

      The terminate as it names suggest kills the the thread so it's state is not guaranteed as mentioned in the documentation.

      Not that you are automagically destroying everything once your operation is done. See your connections to the deleteLater slots.

    • moffa13

      Solved Slot called multiple times to a blocking function in the same thread
      General and Desktop • gui signals&slots threading • • moffa13

      13
      0
      Votes
      13
      Posts
      5064
      Views

      V

      @moffa13 said in Slot called multiple times to a blocking function in the same thread:

      One question : Is it bad to lock and unlock a mutex multiple times ?

      No, that's exactly what they are deigned for

    • Kostas

      Unsolved Sharing QOpenGLContext on devices where QSG runs on main thread
      Mobile and Embedded • opengl under qm android threading qopenglcontext shared • • Kostas

      1
      0
      Votes
      1
      Posts
      563
      Views

      No one has replied

    • P

      Solved Advice on adding threading in database application
      General and Desktop • threading qsqldatabase qsqlquery • • panosk

      10
      0
      Votes
      10
      Posts
      6706
      Views

      kshegunov

      @panosk

      and to be honest I had already started work on this

      You already have that in QSqlDatabase, you only need to keep track of the connections' names.

      Good luck!

    • MichalFasanek

      Unsolved Catching Qt X11 3dMouse events in child thread
      General and Desktop • 3dmouse threading event x11 • • MichalFasanek

      2
      0
      Votes
      2
      Posts
      1021
      Views

      SGaist

      Hi and welcome to devnet,

      What backtrace do you get from the crash ?

    • shrey

      Unsolved BASIC THREADING
      General and Desktop • threading qthread qtcpsocket • • shrey

      2
      0
      Votes
      2
      Posts
      1010
      Views

      SGaist

      Hi and welcome to devnet,

      Are you also new to coding ? If so, then don't start with threads, that's a pretty complex subject that you should take on later after getting the basics correctly.

      Also, for what you described there's no need for threads. Qt's asynchronous nature already provide what's needed.

      Start with Qt's documentation. It also contains the Threading Basics

      On a side note, it's Qt, QT stands for Apple QuickTime which you might also be interested in.

    • Kourpetis

      Unsolved general project gudance ! if it is possible or not
      General and Desktop • python3 while loop threading no clue what so ever • • Kourpetis

      3
      0
      Votes
      3
      Posts
      1126
      Views

      david.hickerson

      @Kourpetis
      Hi, it sounds like your code is getting stuck in your while loop. I believe your code needs threading.

    • P

      Unsolved QObject::connect() vs thread
      General and Desktop • connect thread qt5.5.0 threading • • Pogi

      4
      0
      Votes
      4
      Posts
      1729
      Views

      Chris Kawa

      There's no multi-threading involved here whatsoever. All code here runs in a single thread (unless the timer object and "this" actually live in different threads).

      There's an event loop running in your app and timer events are just the same as any other. They get put in a queue and processed one after another.
      The above will basically mean that your slot is run every time Qt processes messages. It can have very bad influence on your app responsiveness if what you do in the slot is heavy.

      The most obvious question is: if you want a thread why not use an actual QThread instead of emulating it like that?

    • J

      Unsolved Favour invokeMethod or posting a custom event?
      General and Desktop • qevent threading signal & slot • • Jakob

      1
      0
      Votes
      1
      Posts
      657
      Views

      No one has replied

    • V

      Solved [Solved] QFile ReadOnly is thread safe?
      General and Desktop • threading qfile • • VRonin

      3
      0
      Votes
      3
      Posts
      2553
      Views

      V

      Thank you very much

    • David.G

      Working with threads
      General and Desktop • newbie threading qthread • • David.G

      4
      0
      Votes
      4
      Posts
      1610
      Views

      JKSH

      @David.G said:

      Thanks for the reply, @JKSH.

      I've been wondering, I'll remove the code of forever {}, what would be a way to constantly poll if there's data to process? Should I just use a timer every 1 second to keep poking the process method with a simple boolean that returns if process is already running?.

      You're welcome. :) Yes, using a timer is a good way to poll.