![]() |
[Announce][Fremantle] Ten Minute Core Workout
4 Attachment(s)
|
Re: [Announce/WIP] Ten Minute Core Workout
Please, place here screenshots of program Ten Minute Core Workout!
|
Re: [Announce/WIP] Ten Minute Core Workout
Done.
It's not the most exciting screenshot ever. Can anybody help with my buttons, would there be a reason why these slots would not work? Code:
void MainWindow::on_pushButtonStart_clicked() |
Re: [Announce/WIP] Ten Minute Core Workout
Hmm, not sure why that wouldn't be working; it looks exactly like what the Qt documentation says for QProcess.
Maybe there's some sort of permissions problem? There could also be some issue with how the argument is being passed to the shell, I suppose. You might try creating a shell script instead, i.e.: Code:
#!/bin/sh Code:
process.start("yourscriptname.sh"); Code:
pid_t pid = fork(); EDIT: There is apparently an "error()" signal for the QProcess object that gets sent if the call to "start()" fails. Maybe connecting that to a slot to see what it says will provide a bit more info as to what is going on... |
Re: [Announce/WIP] Ten Minute Core Workout
@Copernicus Thanks for the ideas.
Seems changing to this did the trick (pinched from Theme Customizer) No idea why the first version didn't work. Code:
void MainWindow::on_pushButtonStart_clicked() Finally what's the best way to go about implementing portrait support? Ideally I just require the stop button to move below the start in portrait. |
Re: [Announce/WIP] Ten Minute Core Workout
Quote:
I can't help much with properly supporting portrait mode, but you probably knew that already. :) |
Re: [Announce] Ten Minute Core Workout
Your old approach didn't work because the QProcess object fell out of scope. Your second approach seems to result in a memory leak, since you are creating new QProcess objects when the buttons are pressed, without deleting them until the MainWindow object is deleted (since that is the parent). The best solution will be to make it a private member of MainWindow:
Code:
private: For portrait support, you can connect to the resized() signal of QDesktopWidget and adjust the geometry of your widgets as you require. Code:
#include <QApplication> |
Re: [Announce] Ten Minute Core Workout
What about moving this thread to Development section ?
|
Re: [Announce] Ten Minute Core Workout
Quote:
Actually, this also means you don't really need the "kill.sh" script to stop the process (unless kill.sh does something special). A call to "terminate()" (or just destroying the object) should do the trick... EDIT: As Marxian notes below, you can't call "terminate()" on a destroyed QProcess object. :) (In short, you'd need to have a QProcess object that lives beyond the start_clicked() method, call "start()" (not "startDetached()") on it in that method, and call "terminate()" in the stop_clicked() method...) |
Re: [Announce] Ten Minute Core Workout
Quote:
|
All times are GMT. The time now is 13:10. |
vBulletin® Version 3.8.8