matrixion/src/Clipboard.cpp

28 lines
537 B
C++
Raw Normal View History

2021-04-29 23:52:55 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
2021-04-29 22:46:49 +03:00
#include "Clipboard.h"
#include <QClipboard>
#include <QGuiApplication>
Clipboard::Clipboard(QObject *parent)
: QObject(parent)
{
connect(
QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &Clipboard::textChanged);
}
void
Clipboard::setText(QString text)
{
QGuiApplication::clipboard()->setText(text);
}
QString
Clipboard::text() const
{
return QGuiApplication::clipboard()->text();
}