Solved how to close the window
-
Hi,
I'm using qt5.5 on my computer.
This is the UI that i designed.
UIAnd when i click the "Burning Test" Button it will going to this page like below.
pageThen it will execute the .sh file by using QProcess in QT program.
It will show this windows out.
WindowsWhen i clicked stop button (where i show you in the second picture) i will delete all the process and Thread.
This is my program below.
programBut the windows (where i show you in the third picture) will not closed when i clicked the stop button.
Did i miss anything?
Please help! -
First you should close the thread and then close the window.
if(cpuInfoThread->isRunning())
{
cpuInfoThread->quit();
cpuInfoThread->wait(2);
cpuInfoThread->terminate();
cpuInfoThread->wait();
}
window->close() -
@Vinod-Kuntoji
But i didnt using thread to open the window.
i'm using thread on other process. -
Disconnect the process, then kill the process, it will close the console window.
-
@Vinod-Kuntoji
I'm using both process->close(); and process->terminate(); none of those can work as i expect.What else should i so ?
-
Allocate the process in stack instead of heap
-
@victor-wang Did you try http://doc.qt.io/qt-5/qprocess.html#kill ?
-
@jsulm
Yes, I did try this one.
But the window still not close either. -
Hi,
Can you share the code used to start that application ?
-
@SGaist
Sure, this is how i start my application./usr/share/qt5/examples/qt3d/anaglyph-rendering/anaglyph-rendering -platform wayland
I save it as a shell script and using QProcess to execute this .sh file.
-
Why are you using a shell script and not Process directly ?
-
@SGaist
It's just because someone had done it before.
And i just using it by convenient.
Is that the reason why i can't close the window? -
@SGaist
You are right!
I try to using Process instead of shell script and it works as my expect!
Thanks a lot! -
@SGaist
I still have a question.
Why i have to do it directly from Process but not shell script for instead?
I can't understand.
Could you tell me the difference between those two cases? -
Number of layers: you are starting a shell that is starting an application so you'll be "communicating" with that shell but not with the application that was started with that shell.