Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohosclipboardobject.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QOHOSCLIPBOARDOBJECT_H
5#define QOHOSCLIPBOARDOBJECT_H
6
7#include <QtCore/private/qohoscommon_p.h>
8#include <QtCore/qglobal.h>
9#include <QtCore/qmimedata.h>
10#include <database/pasteboard/oh_pasteboard.h>
11#include <memory>
12#include <optional>
13#include <qohosjsscopedataowner.h>
14
16
18{
19public:
25
27 std::function<void(std::optional<PasteboardDataSource>)> &&pasteboardUpdatesNotifier);
28
30 void setMimeDataSync(
31 std::shared_ptr<QMimeData> mimeData, const std::optional<bool> &shareInAppOnly);
33
34protected:
35 QOhosClipboardObject(std::function<void(std::optional<PasteboardDataSource>)> &&pasteboardUpdatesNotifier);
36
37private:
38 struct JsScopeData
39 {
40 std::shared_ptr<::OH_Pasteboard> pasteboard;
41 std::shared_ptr<void> pasteboardDataChangedListenerHandle;
42 std::shared_ptr<std::optional<std::uint32_t>> ownWriteChangeCount;
43 };
44
45 std::shared_ptr<QOhosConsumer<std::optional<PasteboardDataSource>>> m_pasteboardUpdatesNotifier;
46 QtOhos::JsScopeDataOwner<JsScopeData> m_jsScopeData;
47};
48
49QT_END_NAMESPACE
50
51#endif
std::optional< PasteboardDataSource > tryGetPasteboardDataSourceFromChangeCountSync()
std::unique_ptr< QMimeData > getPasteboardDataWithLazyFetch()
void setMimeDataSync(std::shared_ptr< QMimeData > mimeData, const std::optional< bool > &shareInAppOnly)
QOhosClipboardObject(std::function< void(std::optional< PasteboardDataSource >)> &&pasteboardUpdatesNotifier)
static std::unique_ptr< QOhosClipboardObject > makeInstance(std::function< void(std::optional< PasteboardDataSource >)> &&pasteboardUpdatesNotifier)
Combined button and popup list for selecting options.
std::shared_ptr<::OH_PasteboardObserver > createPasteboardDataObserver()
std::shared_ptr< void > subscribePasteboardObserver(std::shared_ptr<::OH_Pasteboard > pasteboard, std::shared_ptr<::OH_PasteboardObserver > pasteboardObserver, ::Pasteboard_NotifyType notifyType, std::function< void()> dataChangedFunc)
QOhosClipboardObject::PasteboardDataSource getPasteboardDataSourceFromChangeCount(::OH_Pasteboard *pasteboard, const std::optional< std::uint32_t > &ownWriteChangeCount)
const char * getPasteboardDataSourceAsString(QOhosClipboardObject::PasteboardDataSource dataSource)
std::optional< std::uint32_t > trySetPasteboardDataAndGetOwnWriteChangeCount(::OH_Pasteboard *pasteboard, ::OH_UdmfData *udmfData)
std::shared_ptr< void > addPasteboardDataChangedListener(std::shared_ptr<::OH_Pasteboard > pasteboard, std::function< void(::Pasteboard_NotifyType)> dataChangedListener, std::vector<::Pasteboard_NotifyType > monitoredNotifyTypes)
const char * getPasteboardNotifyTypeAsString(::Pasteboard_NotifyType notifyType)
bool isPasteboardEmpty(::OH_Pasteboard *pasteboard)
std::uint32_t getPasteboardChangeCount(::OH_Pasteboard *pasteboard)
std::unique_ptr< QOhosUdmfData > tryGetUdmfDataFromPasteboard(::OH_Pasteboard *pasteboard)
std::weak_ptr< QOhosClipboardObject > weakThis