mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-20 13:16:34 -04:00
Change MacPasteboard init object to QScopedPointer
This commit is contained in:
parent
806248ebd4
commit
afe48da4b1
@ -28,25 +28,15 @@ Clipboard* Clipboard::m_instance(nullptr);
|
||||
Clipboard::Clipboard(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_timer(new QTimer(this))
|
||||
#ifdef Q_OS_MAC
|
||||
, m_pasteboard(new MacPasteboard)
|
||||
#endif
|
||||
{
|
||||
m_timer->setSingleShot(true);
|
||||
#ifdef Q_OS_MAC
|
||||
m_pasteboard = new MacPasteboard;
|
||||
#endif
|
||||
|
||||
connect(m_timer, SIGNAL(timeout()), SLOT(clearClipboard()));
|
||||
connect(qApp, SIGNAL(aboutToQuit()), SLOT(clearCopiedText()));
|
||||
}
|
||||
|
||||
Clipboard::~Clipboard()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
if (m_pasteboard) {
|
||||
delete m_pasteboard;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Clipboard::setText(const QString& text)
|
||||
{
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
|
@ -31,7 +31,6 @@ class Clipboard : public QObject
|
||||
|
||||
public:
|
||||
void setText(const QString& text);
|
||||
~Clipboard();
|
||||
|
||||
static Clipboard* instance();
|
||||
|
||||
@ -48,7 +47,7 @@ private:
|
||||
|
||||
QTimer* m_timer;
|
||||
#ifdef Q_OS_MAC
|
||||
MacPasteboard* m_pasteboard;
|
||||
QScopedPointer<MacPasteboard> m_pasteboard;
|
||||
#endif
|
||||
QString m_lastCopied;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user