Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to running logic after window and widget is shown up?



  • Hi guys,
    I want to build non user interaction application using qt but i'm confused. How to running my logic or initialization logic after window and widget is shown up? it must be multithreading or not? i have try running those logic using invoke method but my widget will visible after those logic is done.
    in my case, my first ui is loading or progress bar, and if my progress bar is shown up, i will running my initialization logic, and update progress bar. how to achieve that?
    Thanks guys, i'am new in Qt btw.


  • Banned

    This post is deleted!


  • @callmejauhari
    Hi & welcome. Sorry you didn't get a helpful answer.

    You will have to explain a bit what you are trying to do. For one thing, you say

    I want to build non user interaction application

    but then you tell us you are using widgets/windows?

    You can set off a QProgressBar or a QSplashScreen to show early and then remove it when you are ready to proceed. You can also do logic work when, say, a widget/window is first opened/shown to the user, if that's what you want.

    But one thing you are unlikely to want is "multithreading". If at all possible, especially as a beginner, don't jump into threads. Qt is a naturally "asynchronous" framework, usually it's possible to do things without blocking the UI yet without creating your own threads. (I'm not saying there are not cases you might actually need a thread, just that you need a good reason if you do.)

    Anyway, as I said, to answer better we'd need some more detail about what you are trying to do when.


Log in to reply