Accessibility plugin for mac and xcb.

Instead of creating new instances of the class whenever
accessibility() is called, create one on startup.

Change-Id: Idd5b06ee935d7acf4934b98882d254a1ef0ca04e
Reviewed-on: http://codereview.qt-project.org/6435
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
This commit is contained in:
Frederik Gladhorn 2011-10-11 14:43:28 +02:00 committed by Qt by Nokia
parent bb22b49650
commit 736b3a6aca
5 changed files with 25 additions and 1 deletions

View File

@ -217,7 +217,7 @@ QPlatformInputContext *QPlatformIntegration::inputContext() const
*/
QPlatformAccessibility *QPlatformIntegration::accessibility() const
{
return new QPlatformAccessibility;
return 0;
}
QVariant QPlatformIntegration::styleHint(StyleHint hint) const

View File

@ -86,11 +86,13 @@ public:
QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
QPlatformNativeInterface *nativeInterface() const;
QPlatformAccessibility *accessibility() const;
private:
QPlatformFontDatabase *mFontDb;
QAbstractEventDispatcher *mEventDispatcher;
QCocoaAutoReleasePool *mPool;
QPlatformAccessibility *mAccessibility;
};
QT_END_NAMESPACE

View File

@ -51,6 +51,7 @@
#include "qcocoaapplicationdelegate.h"
#include "qmenu_mac.h"
#include <QtGui/qplatformaccessibility_qpa.h>
#include <QtCore/qcoreapplication.h>
#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
@ -124,10 +125,13 @@ QCocoaIntegration::QCocoaIntegration()
QCocoaScreen *screen = new QCocoaScreen(i);
screenAdded(screen);
}
mAccessibility = new QPlatformAccessibility;
}
QCocoaIntegration::~QCocoaIntegration()
{
delete mAccessibility;
delete mPool;
}
@ -183,4 +187,9 @@ QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
return new QCocoaNativeInterface();
}
QPlatformAccessibility *QCocoaIntegration::accessibility() const
{
return mAccessibility;
}
QT_END_NAMESPACE

View File

@ -78,6 +78,7 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QScreen>
#include <QtGui/QPlatformAccessibility>
QXcbIntegration::QXcbIntegration(const QStringList &parameters)
: m_eventDispatcher(createUnixEventDispatcher())
@ -104,11 +105,14 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters)
m_nativeInterface = new QXcbNativeInterface;
m_inputContext = QPlatformInputContextFactory::create();
m_accessibility = new QPlatformAccessibility();
}
QXcbIntegration::~QXcbIntegration()
{
qDeleteAll(m_connections);
delete m_accessibility;
}
QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
@ -228,3 +232,8 @@ QPlatformInputContext *QXcbIntegration::inputContext() const
{
return m_inputContext;
}
QPlatformAccessibility *QXcbIntegration::accessibility() const
{
return m_accessibility;
}

View File

@ -74,6 +74,8 @@ public:
QPlatformInputContext *inputContext() const;
QPlatformAccessibility *accessibility() const;
private:
QList<QXcbConnection *> m_connections;
@ -82,6 +84,8 @@ private:
QPlatformInputContext *m_inputContext;
QAbstractEventDispatcher *m_eventDispatcher;
QPlatformAccessibility *m_accessibility;
};
QT_END_NAMESPACE