Help: How to design/edit the "push button" slot(e.g. scan())
-
Hello smart guys:
1)I have installed some "the command line" platforms on Fedora 19(x86_64)
2)Those platforms with some "command" could scan the system.
3)I have installed the latest Qt creator.
4)I find the push button widget in Qt designer, and I hope that I would use it as the "scan" behavior.
Should I import or edit the new one slot on such button widget?
How to do it?
Thank you gratefully -
Have a look at the "wiki article about using QPushBUtton":http://qt-project.org/wiki/How_to_Use_QPushButton. Implement your scanning functionality to a slot and connect it to the released signal of the button.
-
**Execuse me,sir:
I am a newbie for it.
Could you provide the detailed example or method to implement the scan operation on the QPushBUtton ?
My schema are as following:- open the terminal
- perform scan : keyin "command parameter --output result.file source.file" under the prompt on the terminal
- How to convert the 2ndQustion to the button
- that is. connect(button, signal(clicked()), slot, scan())
- source.file path-->"button" , and then press "the button" to start to scan
-
In general it is not a good idea to run an external application through another app but you can do this in "Qt using class QProcess and its method start":http://qt-project.org/doc/qt-5/qprocess.html#start:
@
QProcess process;
process.start("command");
@As an optional second argument you can specify arguments that should be passed the to the command. So in general you can bind a slot that executes the command to the signal emitted by the button.
I repeat again that in general running an external application/command through Qt app is not recommended and it is better to implement everything inside you app.