clipboard
(cherry picked from commit 3f5c0e26e0f8b6876c3fb4d3822df49c748b2eea)
This commit is contained in:
parent
0d12e17d25
commit
9b8759284b
@ -544,7 +544,7 @@ FontHash *qt_app_fonts_hash()
|
||||
QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus
|
||||
|
||||
QDesktopWidget *qt_desktopWidget = 0; // root window widgets
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
|
||||
QClipboard *qt_clipboard = 0; // global clipboard object
|
||||
#endif
|
||||
QWidgetList * qt_modal_stack=0; // stack of modal widgets
|
||||
@ -1084,7 +1084,7 @@ QApplication::~QApplication()
|
||||
{
|
||||
Q_D(QApplication);
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
|
||||
// flush clipboard contents
|
||||
if (qt_clipboard) {
|
||||
QEvent event(QEvent::Clipboard);
|
||||
@ -1099,8 +1099,10 @@ QApplication::~QApplication()
|
||||
d->toolTipWakeUp.stop();
|
||||
d->toolTipFallAsleep.stop();
|
||||
|
||||
#if !defined(Q_WS_QPA)
|
||||
d->eventDispatcher->closingDown();
|
||||
d->eventDispatcher = 0;
|
||||
#endif
|
||||
QApplicationPrivate::is_app_closing = true;
|
||||
QApplicationPrivate::is_app_running = false;
|
||||
|
||||
@ -1122,7 +1124,7 @@ QApplication::~QApplication()
|
||||
delete qt_desktopWidget;
|
||||
qt_desktopWidget = 0;
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
|
||||
delete qt_clipboard;
|
||||
qt_clipboard = 0;
|
||||
#endif
|
||||
@ -3258,7 +3260,7 @@ QDesktopWidget *QApplication::desktop()
|
||||
return qt_desktopWidget;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
|
||||
/*!
|
||||
Returns a pointer to the application global clipboard.
|
||||
|
||||
@ -3276,8 +3278,7 @@ QClipboard *QApplication::clipboard()
|
||||
}
|
||||
return qt_clipboard;
|
||||
}
|
||||
#endif // QT_NO_CLIPBOARD
|
||||
|
||||
#endif // Q_WS_QPA && QT_NO_CLIPBOARD
|
||||
/*!
|
||||
Sets whether Qt should use the system's standard colors, fonts, etc., to
|
||||
\a on. By default, this is true.
|
||||
|
@ -188,7 +188,7 @@ public:
|
||||
|
||||
static QWidget *activePopupWidget();
|
||||
static QWidget *activeModalWidget();
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
|
||||
static QClipboard *clipboard();
|
||||
#endif
|
||||
static QWidget *focusWidget();
|
||||
|
@ -109,6 +109,7 @@ protected:
|
||||
|
||||
friend class QApplication;
|
||||
friend class QApplicationPrivate;
|
||||
friend class QGuiApplication;
|
||||
friend class QBaseApplication;
|
||||
friend class QDragManager;
|
||||
friend class QMimeSource;
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "private/qevent_p.h"
|
||||
|
||||
#include <QtCore/private/qcoreapplication_p.h>
|
||||
#include <QtCore/private/qabstracteventdispatcher_p.h>
|
||||
#include <QtDebug>
|
||||
|
||||
#include <QtGui/QPlatformIntegration>
|
||||
@ -54,6 +55,10 @@
|
||||
#include <QWindowSystemInterface>
|
||||
#include "private/qwindowsysteminterface_qpa_p.h"
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
#include <QtGui/QClipboard>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Qt::MouseButtons QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
|
||||
@ -83,6 +88,10 @@ int QGuiApplicationPrivate::mouse_double_click_distance = 5;
|
||||
|
||||
QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0;
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
QClipboard *QGuiApplicationPrivate::qt_clipboard = 0;
|
||||
#endif
|
||||
|
||||
QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
|
||||
: QCoreApplication(*new QGuiApplicationPrivate(argc, argv, flags))
|
||||
{
|
||||
@ -97,6 +106,18 @@ QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
|
||||
|
||||
QGuiApplication::~QGuiApplication()
|
||||
{
|
||||
Q_D(QGuiApplication);
|
||||
// flush clipboard contents
|
||||
if (QGuiApplicationPrivate::qt_clipboard) {
|
||||
QEvent event(QEvent::Clipboard);
|
||||
QApplication::sendEvent(QGuiApplicationPrivate::qt_clipboard, &event);
|
||||
}
|
||||
|
||||
d->eventDispatcher->closingDown();
|
||||
d->eventDispatcher = 0;
|
||||
|
||||
delete QGuiApplicationPrivate::qt_clipboard;
|
||||
QGuiApplicationPrivate::qt_clipboard = 0;
|
||||
}
|
||||
|
||||
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
|
||||
@ -703,5 +724,19 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange(
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
QClipboard * QGuiApplication::clipboard()
|
||||
{
|
||||
if (QGuiApplicationPrivate::qt_clipboard == 0) {
|
||||
if (!qApp) {
|
||||
qWarning("QApplication: Must construct a QApplication before accessing a QClipboard");
|
||||
return 0;
|
||||
}
|
||||
QGuiApplicationPrivate::qt_clipboard = new QClipboard(0);
|
||||
}
|
||||
return QGuiApplicationPrivate::qt_clipboard;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -79,10 +79,10 @@ public:
|
||||
static QFont font(const char *className);
|
||||
static void setFont(const QFont &, const char* className = 0);
|
||||
static QFontMetrics fontMetrics();
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
static QClipboard *clipboard();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static Qt::KeyboardModifiers keyboardModifiers();
|
||||
|
@ -114,6 +114,9 @@ public:
|
||||
static int mousePressY;
|
||||
static int mouse_double_click_distance;
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
static QClipboard *qt_clipboard;
|
||||
#endif
|
||||
private:
|
||||
void init();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user