matrixion/src/Clipboard.cpp

27 lines
509 B
C++
Raw Normal View History

// SPDX-FileCopyrightText: Nheko Contributors
2021-04-29 23:52:55 +03:00
//
// 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)
{
2021-09-18 01:22:33 +03:00
connect(QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &Clipboard::textChanged);
2021-04-29 22:46:49 +03:00
}
void
Clipboard::setText(QString text)
{
2021-09-18 01:22:33 +03:00
QGuiApplication::clipboard()->setText(text);
2021-04-29 22:46:49 +03:00
}
QString
Clipboard::text() const
{
2021-09-18 01:22:33 +03:00
return QGuiApplication::clipboard()->text();
2021-04-29 22:46:49 +03:00
}