mirror of
https://github.com/tnodir/fort
synced 2024-11-17 22:15:56 +00:00
36 lines
683 B
C++
36 lines
683 B
C++
|
#include "osutil.h"
|
||
|
|
||
|
#include <QApplication>
|
||
|
#include <QClipboard>
|
||
|
#include <QPixmap>
|
||
|
#include <QImage>
|
||
|
|
||
|
#include "processinfo.h"
|
||
|
|
||
|
OsUtil::OsUtil(QObject *parent) :
|
||
|
QObject(parent)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void OsUtil::setClipboardData(const QVariant &data)
|
||
|
{
|
||
|
QClipboard *clipboard = QApplication::clipboard();
|
||
|
|
||
|
switch (data.type()) {
|
||
|
case QVariant::Pixmap:
|
||
|
clipboard->setPixmap(data.value<QPixmap>());
|
||
|
break;
|
||
|
case QVariant::Image:
|
||
|
clipboard->setImage(data.value<QImage>());
|
||
|
break;
|
||
|
default:
|
||
|
clipboard->setText(data.toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
QString OsUtil::pidToDosPath(quint32 pid)
|
||
|
{
|
||
|
const ProcessInfo pi(pid);
|
||
|
return pi.dosPath();
|
||
|
}
|