swift
Loading...
Searching...
No Matches
pixmap.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_PIXMAP_H
7#define SWIFT_MISC_PIXMAP_H
8
9#include <QByteArray>
10#include <QMetaType>
11#include <QPixmap>
12#include <QReadWriteLock>
13#include <QString>
14
15#include "misc/metaclass.h"
17#include "misc/valueobject.h"
18
20
21namespace swift::misc
22{
23 class CStatusMessage;
24
27 class SWIFT_MISC_EXPORT CPixmap : public CValueObject<CPixmap>
28 {
29 public:
31 CPixmap() = default;
32
34 CPixmap(const QPixmap &pixmap);
35
37 CPixmap(const CPixmap &other);
38
40 CPixmap &operator=(const CPixmap &other);
41
43 ~CPixmap() = default;
44
46 const QPixmap &pixmap() const;
47
49 operator QPixmap() const;
50
52 bool isNull() const;
53
55 QPixmap toPixmap() const;
56
58 QString convertToQString(bool i18n = false) const;
59
60 private:
62 void fillByteArray();
63
64 QByteArray m_array;
65 mutable QPixmap m_pixmap;
66 mutable bool m_hasCachedPixmap = false;
67 mutable QReadWriteLock m_lock;
68
70 CPixmap,
71 SWIFT_METAMEMBER(array));
72 };
73} // namespace swift::misc
74
75Q_DECLARE_METATYPE(swift::misc::CPixmap)
76
77#endif // SWIFT_MISC_PIXMAP_H
Pixmap which can be transferred via DBus.
Definition pixmap.h:28
bool isNull() const
With Pixmap?
Definition pixmap.cpp:59
const QPixmap & pixmap() const
Corresponding pixmap.
Definition pixmap.cpp:38
CPixmap()=default
Default constructor.
QString convertToQString(bool i18n=false) const
Cast as QString.
Definition pixmap.cpp:71
CPixmap & operator=(const CPixmap &other)
Copy assignment (because of mutex).
Definition pixmap.cpp:22
~CPixmap()=default
Destructor.
QPixmap toPixmap() const
Corresponding pixmap.
Definition pixmap.cpp:77
Streamable status message, e.g.
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition metaclass.h:72
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition metaclass.h:52
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition valueobject.h:65