summary refs log tree commit diff
path: root/src/Clipboard.cpp
blob: 72a954ced1cc8a85af8e58ae6174ab37da912327 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#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();
}