Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

qcop tool

The qcop command-line tool can be used to access the Qt Extended IPC system from shell scripts and for debugging purposes. Running qcop without any arguments will print a help message. The other commands are as follows:

CommandDescription
qcop send channel message [parameters]Send message on channel with the specified parameters.
qcop service send name message [parameters]Send message to the application that implements the service name with the specified parameters.
qcop watch channel [channel ...]Watch all messages on channel and print them to standard output. If channel has the form QPE/Application/foo, this will watch all messages to the application foo.
qcop service watch name [name ...]Same as above, but watches the application associated with the service name instead.
qcop wait channel messageWaits for message to appear on channel and then prints the message arguments to standard output.
qcop service wait name messageSame as above, but waits on the application channel for the application associated with the service. This can be used to wait for someone to send a message to the service.
qcop query channelQuery all messages that the application on channel can respond to. The application needs to handle the special message __query_qcop_messages(QString) for this to work correctly. The easiest method is to use the QtopiaIpcAdaptor or QtopiaAbstractService classes to implement your service. These classes will automatically respond to the query message. The argument to the message is the name of the channel to respond on. The qcop query command has a default timeout of 1 second unless overridden by the timeout flag.
qcop service query nameSame as above, but for the service called name.
qcop listList all services and the Qt Extended IPC channels that they map to.

The following flags can be specified before a command to modify its behavior:

FlagDescription
hexPrint the contents of QByteArray parameters in hexadecimal (default).
nohexPrint the contents of QByteArray parameters as Latin-1 strings.
timeout msecsSet the timeout for the command to msecs milliseconds.
notimeoutDisable the timeout for the command. This is the default for most commands, except qcop query which has a default timeout of 1 second.
enum nameRecognise name as an enumerated type in message names.

The following example will watch for all Qt Extended IPC messages on the QPE/System channel:

    qcop watch QPE/System

The channel name for qcop watch can include wildcards. For example, the following will watch all network-related channels:

    qcop watch 'QPE/Network*'

It is usually necessary to quote channel names when they include wildcards, especially when using qcop watch '*'.

The following example sends a Time::editTime() message to the Time service:

    qcop service send Time 'editTime()'

Multiple commands can be separated by -- on the command line. The following example sends the dial() message to the QPE/pppd channel and then waits for up to 30 seconds for a dialResult(bool) message on the same channel.

    qcop send QPE/pppd 'dial()' -- timeout 30000 wait QPE/pppd 'dialResult(bool)'


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3