18#include <QtGui/qpointingdevice.h>
19#include <QtGui/private/qguiapplication_p.h>
20#include <QtGui/private/qrhibackingstore_p.h>
23#include <qpa/qplatformoffscreensurface.h>
25#include <QtGui/private/qcoretextfontdatabase_p.h>
26#include <QtGui/private/qmacmimeregistry_p.h>
27#include <QtGui/qutimimeconverter.h>
29#include <QOperatingSystemVersion>
35#import <AudioToolbox/AudioServices.h>
52#
if !defined(Q_OS_TVOS) && !defined(QT_NO_CLIPBOARD)
61 qFatal(
"Error: You are creating QApplication before calling UIApplicationMain.\n" \
62 "If you are writing a native iOS application, and only want to use Qt for\n" \
63 "parts of the application, a good place to create QApplication is from within\n" \
64 "'applicationDidFinishLaunching' inside your UIApplication delegate.\n");
73 UIScreen *mainScreen = [UIScreen mainScreen];
74 NSMutableArray<UIScreen *> *screens = [[[UIScreen screens] mutableCopy] autorelease];
75 if (![screens containsObject:mainScreen]) {
77 [screens insertObject:mainScreen atIndex:0];
89 if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)
91 m_touchDevice->setCapabilities(touchCapabilities);
93#if QT_CONFIG(tabletevent)
100 qobject_cast<QIosOptionalPluginInterface *>(m_optionalPlugins->
instance(
i))->initPlugin();
105 delete m_fontDatabase;
108#if !defined(Q_OS_TVOS) && !defined(QT_NO_CLIPBOARD)
115 delete m_inputContext;
121 delete m_platformServices;
122 m_platformServices = 0;
124 delete m_accessibility;
127 delete m_optionalPlugins;
128 m_optionalPlugins = 0;
184 bool isValid()
const override {
return true; }
199 return m_fontDatabase;
202#ifndef QT_NO_CLIPBOARD
215 return m_inputContext;
220 return m_platformServices;
256 return m_touchDevice;
259#if QT_CONFIG(accessibility)
260QPlatformAccessibility *QIOSIntegration::accessibility()
const
262 if (!m_accessibility)
263 m_accessibility =
new QIOSPlatformAccessibility;
264 return m_accessibility;
275#if !TARGET_IPHONE_SIMULATOR
276 AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
282 UIApplication.sharedApplication.applicationIconBadgeNumber =
number;
296 if (lowerCaseResource ==
"uiview")
297 return reinterpret_cast<void *
>(platformWindow->
winId());
306#include "moc_qiosintegration.cpp"
QByteArray toLower() const &
static bool setCurrent(const QString &path)
Sets the application's current working directory to path.
MetaDataList metaData() const
QObject * instance(int index) const
static QPlatformIntegration * platformIntegration()
static QList< QScreen * > screens()
Returns a list of all the screens associated with the windowing system the application is connected t...
static QIOSEventDispatcher * create()
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QVariant styleHint(StyleHint hint) const override
QPlatformTheme * createPlatformTheme(const QString &name) const override
void * nativeResourceForWindow(const QByteArray &resource, QWindow *window) override
void beep() const override
static QIOSIntegration * instance()
QPlatformClipboard * clipboard() const override
Accessor for the platform integration's clipboard.
QPlatformOffscreenSurface * createPlatformOffscreenSurface(QOffscreenSurface *surface) const override
Factory function for QOffscreenSurface.
void setApplicationBadge(qint64 number) override
QPointingDevice * touchDevice()
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QStringList themeNames() const override
QPlatformNativeInterface * nativeInterface() const override
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QPlatformServices * services() const override
bool hasCapability(Capability cap) const override
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
bool isValid() const override
Returns true if the platform offscreen surface has been allocated.
QIOSOffscreenSurface(QOffscreenSurface *offscreenSurface)
QSurfaceFormat format() const override
Returns the actual surface format of the offscreen surface.
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
qsizetype size() const noexcept
QSurfaceFormat requestedFormat() const
Returns the requested surfaceformat of this offscreen surface.
The QPlatformInputContext class abstracts the input method dependent data and composing state.
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
The QScreen class is used to query screen properties. \inmodule QtGui.
QPlatformScreen * handle() const
Get the platform screen handle.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static void setPlatformSynthesizesMouse(bool v)
static void registerInputDevice(const QInputDevice *device)
static void handleScreenAdded(QPlatformScreen *screen, bool isPrimary=false)
Should be called by the implementation whenever a new screen is added.
static void handleScreenRemoved(QPlatformScreen *screen)
Should be called by the implementation whenever a screen is removed.
void initializeMimeTypes()
Combined button and popup list for selecting options.
bool qt_apple_isApplicationExtension()
AppleApplication * qt_apple_sharedApplication()
#define QIosOptionalPluginInterface_iid
GLenum GLuint GLintptr GLsizeiptr size
[1]
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
if(qFloatDistance(a, b)<(1<< 7))
[0]