diff options
Diffstat (limited to 'doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp')
-rw-r--r-- | doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp b/doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp new file mode 100644 index 0000000..98fa4a9 --- /dev/null +++ b/doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp @@ -0,0 +1,26 @@ +//! [0] +void MyClass::receive(const QString &message, const QByteArray &data) +{ + QDataStream in(data); + if (message == "execute(QString,QString)") { + QString cmd; + QString arg; + in >> cmd >> arg; + ... + } else if (message == "delete(QString)") { + QString fileName; + in >> fileName; + ... + } else { + ... + } +} +//! [0] + + +//! [1] +QByteArray data; +QDataStream out(&data, QIODevice::WriteOnly); +out << QString("cat") << QString("file.txt"); +QCopChannel::send("System/Shell", "execute(QString,QString)", data); +//! [1] |