matrixion/src/Clipboard.cpp

28 lines
565 B
C++
Raw Permalink Normal View History

2021-04-29 23:52:55 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 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
}