basically yes, the slot is not the shell command, but rather executes it.
{
Q_OBJECT
public:
ClassA();
signals:
void someSignale();
};
{
Q_OBJECT
public:
ClassB();
public slots:
someSlot()
{
system("some shell command");
}
};
// somewhere else
ClassA a;
ClassB b;
b.connect(&a, SIGNAL(someSignal()), SLOT(someSlot()));
somewhere in ClassA:
emit someSignal();
class ClassA : public QObject
{
Q_OBJECT
public:
ClassA();
signals:
void someSignale();
};
class ClassB : public QObject
{
Q_OBJECT
public:
ClassB();
public slots:
someSlot()
{
system("some shell command");
}
};
// somewhere else
ClassA a;
ClassB b;
b.connect(&a, SIGNAL(someSignal()), SLOT(someSlot()));
somewhere in ClassA:
emit someSignal();
To copy to clipboard, switch view to plain text mode
When ClassA emits this signal, all the slots connected to it will be executed (in an undefined order).
In a slot you may execute any code you like, e.g. call some shell command.
Read up the tutorials etc in the excellent Qt docs!
HTH.
Bookmarks