mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Replace qetsingleapplication by singleApplication.
See : https://github.com/itay-grudev/SingleApplication git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5481 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
25
SingleApplication/examples/sending_arguments/main.cpp
Executable file
25
SingleApplication/examples/sending_arguments/main.cpp
Executable file
@@ -0,0 +1,25 @@
|
||||
#include <singleapplication.h>
|
||||
#include "messagereceiver.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Allow secondary instances
|
||||
SingleApplication app( argc, argv, true );
|
||||
|
||||
MessageReceiver msgReceiver;
|
||||
|
||||
// If this is a secondary instance
|
||||
if( app.isSecondary() ) {
|
||||
app.sendMessage( app.arguments().join(' ').toUtf8() );
|
||||
return 0;
|
||||
} else {
|
||||
QObject::connect(
|
||||
&app,
|
||||
&SingleApplication::receivedMessage,
|
||||
&msgReceiver,
|
||||
&MessageReceiver::receivedMessage
|
||||
);
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user