2020-01-24 21:36:51 +01:00
|
|
|
#include "util/Clipboard.hpp"
|
|
|
|
#include <QApplication>
|
|
|
|
|
2021-05-08 15:57:00 +02:00
|
|
|
#include <QClipboard>
|
|
|
|
|
2020-01-24 21:36:51 +01:00
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
void crossPlatformCopy(const QString &text)
|
|
|
|
{
|
|
|
|
auto clipboard = QApplication::clipboard();
|
2021-02-06 15:47:09 +01:00
|
|
|
|
2020-01-24 21:36:51 +01:00
|
|
|
clipboard->setText(text);
|
2021-02-06 15:47:09 +01:00
|
|
|
|
2020-01-24 21:36:51 +01:00
|
|
|
if (clipboard->supportsSelection())
|
|
|
|
{
|
|
|
|
clipboard->setText(text, QClipboard::Selection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-06 15:47:09 +01:00
|
|
|
QString getClipboardText()
|
|
|
|
{
|
|
|
|
return QApplication::clipboard()->text();
|
|
|
|
}
|
|
|
|
|
2020-01-24 21:36:51 +01:00
|
|
|
} // namespace chatterino
|