#include <QtGui/QApplication>
#include <QtCore>
#include <QtDBus>

#ifndef QCBADAPTER_H
#define QCBADAPTER_H

class QCBAdapter: public QDBusAbstractAdaptor
 {
     Q_OBJECT
     Q_CLASSINFO("D-Bus Interface", "DBus.Manager.PrintString")
     Q_PROPERTY(QString str READ read_str WRITE write_str)
 public:
     //QApplication *app;
     QString str;
     QCBAdapter(QCoreApplication *application)
         : QDBusAbstractAdaptor(application)
     {
     }
     Q_INVOKABLE QString read_str()
     {
            printf("Выводим строкуn");
            return str;
     }
     Q_INVOKABLE void write_str(const QString &newContent;)
     {
        printf("Изменяем строкуn");
        str = newContent;
     }

public slots:
     Q_NOREPLY void emptyClipboard()
     {
            printf("Очищаем строкуn");
            str = "";
     }
 };

#endif // QCBADAPTER_H

Add a code snippet to your website: www.paste.org