Results 1 to 2 of 2

Thread: Qt project stops working when changing location mainwindow

  1. #1
    Join Date
    Feb 2021
    Posts
    2
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Qt project stops working when changing location mainwindow

    I am working on a project which is collecting much data continuously from BUS. Im able to build and run without any problem. Everything is perfect ultil i try to relocate my projects mainwindow on running project(meanwhile data is still incoming). My data flow is stopping when i click projects window to relocate it. And it continues from where it paused when i release my left click on window. What am i missing? Thanks in advance.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,884
    Thanks
    274
    Thanked 794 Times in 784 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Qt project stops working when changing location mainwindow

    What am i missing? Thanks in advance.
    Moving (and probably resizing, too) the main window is a blocking operation. The Qt event loop is handling both UI interactions and the data coming from your bus, so when a blocking operation occurs, the data stops. The same thing would happen if you opened a modal QDialog - the dialog has its own event loop, and the main event loop will be suspended while the dialog is open. As you observe, no events are lost, they just accumulate until the main event loop gets to run again.

    The solution is to move your data collection to a separate thread, independent of the GUI thread. Each Qt thread has its own independent event loop, so data collection can continue no matter what the main GUI thread is doing.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. The following user says thank you to d_stranz for this useful post:

    akincio (24th February 2021)

Similar Threads

  1. Replies: 0
    Last Post: 11th July 2018, 21:14
  2. QSerialPort - readyRead stops working
    By ShamusVW in forum Qt Programming
    Replies: 2
    Last Post: 22nd June 2018, 19:20
  3. Signals stops working
    By JaroMast in forum Qt Programming
    Replies: 4
    Last Post: 28th August 2012, 19:34
  4. gdb stops working for Qt program ???
    By enno in forum Qt Programming
    Replies: 0
    Last Post: 27th February 2011, 12:47
  5. Application stops working unexpectedly
    By baluk in forum Newbie
    Replies: 16
    Last Post: 20th November 2010, 15:06

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.