summary refs log tree commit diff
path: root/src/Clipboard.cpp
blob: d4d5bab78a3deb8b48628a2ea705835c2208e5c5 (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-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();
}