Reply
Thread Tools
Posts: 18 | Thanked: 2 times | Joined on Apr 2010 @ Germany
#1
Hi there,

i've written a qt app with the QT Creator...just a simple one.
For testing only, i've add a combobox and a "Apply" Button.

The Button should run a shell script, which should do something.
(with Variable from the combobox).

My Problem is, that nothing happend, when i push the Button

The part of the Button looks so:

Code:
void MainWindow::on_applypush_clicked()
{
    QStringList combo;
    combo << ui->comboBox->currentText();
    QProcess *process = new QProcess(this);
    process->start("./sbin/xicon", combo);
}
Could anyone help me, with my Problem ?
 
d-iivil's Avatar
Posts: 2,154 | Thanked: 2,186 times | Joined on Dec 2009 @ Hellsinki, Finland
#2
Originally Posted by Dr.Heyde View Post
Hi there,

i've written a qt app with the QT Creator...just a simple one.
For testing only, i've add a combobox and a "Apply" Button.

The Button should run a shell script, which should do something.
(with Variable from the combobox).

My Problem is, that nothing happend, when i push the Button

The part of the Button looks so:

Code:
void MainWindow::on_applypush_clicked()
{
    QStringList combo;
    combo << ui->comboBox->currentText();
    QProcess *process = new QProcess(this);
    process->start("./sbin/xicon", combo);
}
Could anyone help me, with my Problem ?
Is your script executable (chmod a+x /sbin/xicon)?
You can also leave out the . -mark from QT-code.

And one more thing, you are running your QT-app as user, not as root are you?
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P

80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE
 

The Following User Says Thank You to d-iivil For This Useful Post:
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#3
I'd start with the path to the binary. As pointed out above. the "." makes a difference.

With a path starting with ".", it becomes a relative path, relative to whatever the Qt application has as current working directory.

So, remove that and try again.
 

The Following User Says Thank You to Joorin For This Useful Post:
Posts: 18 | Thanked: 2 times | Joined on Apr 2010 @ Germany
#4
Hi & Thx 4 Reply D-livil

1st.: i start script 1 with following inserts :

#! /bin/sh -e
sudo zicon
Sript 2(zicon) is the "real" shell.

So, yes...it`s start as root

Im really new to Qt so, sorry for my bad knowledge *g

Is'it working if i make the execution (chmod a+x /sbin/xicon) in a linux system an copy the Files to the place ?
Or have i to go another Way?

Kind Regards

€dit: I remove the "."
€dit2: It dosent work for me

and hmm, how do i start the qt app.....i start it with the button *gg*
how i said....im really ,really new to qt an i'm very thankfully for every tip !

here's my cpp + h... have i anything forgotten ?

http://pastie.org/1061122

http://pastie.org/1061127

Last edited by Dr.Heyde; 2010-07-26 at 21:03.
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#5
Hi,

RE. the script: You have whitelisted zicon in /etc/sudoers.d (and ran update-sudoers afterwards)? If you haven't, sudo's gonna be waiting asking for a password. And depending on the way you've written the could-be sudoers file, running "sudo zicon" as root will make sudo do absolutely nothing
 

The Following User Says Thank You to qwerty12 For This Useful Post:
benlau's Avatar
Posts: 135 | Thanked: 375 times | Joined on Mar 2010 @ Hong Kong
#6
I think it is related to the path setting / or exec bits. You may verify by process->error() (or capture the error() signal) . If It is QProcess::FailedToStart , then it was not able to start the program.
__________________
Qt Ambassador | Nokia Certified Qt Specialist
PenPen SketchBook |
FrontView - 0.2 is released! | DQuest
Status: Now working on GTD software
 

The Following User Says Thank You to benlau For This Useful Post:
Posts: 18 | Thanked: 2 times | Joined on Apr 2010 @ Germany
#7
Well, i think, that the Problem is from the other side....
I've the directory "Data" with all my realated Files in Subdirectories, but the Problem seems to be, that the Files are after the installation gone ?!? I don`t know how,but they are gone....*gg
My "Sudoers File" -->gone
My "scripts"-->gone.
Such Problems on so a simple thing....can´t believe it..
I´m searching over and over....

KR
 
Posts: 18 | Thanked: 2 times | Joined on Apr 2010 @ Germany
#8
...got it....it was a sudoers problem...thank you qwerty12 and all the others who helped me !

Now, is there a way to reboot the system with a Clicked Signal....?

I mean this solution :
Code:
dbus-send --system --type=method_call --print-reply --dest=com.nokia.mce "/com/nokia/mce/request" com.nokia.mce.request.req_reboot
should not be the best one....

Or do I have to make a shellscript with an simple " reboot" inside. (ofcourse, with sudo rights)
 

The Following User Says Thank You to Dr.Heyde For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 07:48.