Various compilation scripts & patches for Linux programs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.0 KiB

  1. #include <QApplication>
  2. #include <QTimer>
  3. #include <QClipboard>
  4. #include <QMimeData>
  5. #include <QDebug>
  6. #include <QStringList>
  7. class App: public QObject {
  8. Q_OBJECT
  9. private:
  10. void main();
  11. public:
  12. App(): QObject() { }
  13. public slots:
  14. void qtmain() { main(); emit finished(); }
  15. signals:
  16. void finished();
  17. };
  18. void App::main() {
  19. QClipboard *clip = QApplication::clipboard();
  20. for(QString& formatName: clip->mimeData()->formats()) {
  21. std::string s;
  22. s = formatName.toStdString();
  23. QByteArray arr = clip->mimeData()->data(formatName);
  24. printf("name=%s, size=%d: ", s.c_str(), arr.size());
  25. for(int i = 0; i < arr.size(); i++) {
  26. printf("%02x ", (unsigned char) arr.at(i));
  27. }
  28. printf("\n");
  29. }
  30. }
  31. int main(int argc, char **argv) {
  32. QApplication app(argc, argv);
  33. App *task = new App();
  34. QObject::connect(task, SIGNAL(finished()), & app, SLOT(quit()));
  35. QTimer::singleShot(0, task, SLOT(qtmain()));
  36. return app.exec();
  37. }
  38. #include "xclipshow.moc"