diff options
author | Ian <ian@mediator-software.com> | 2011-06-20 13:26:26 (GMT) |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2011-06-27 13:48:26 (GMT) |
commit | 6f9cd3170d917c8ab3b526d3e4cc33c714e26648 (patch) | |
tree | 651e0392d9d29474aa0626cbc439a72b0020701a | |
parent | cad13a0bbe738a71b9716cb6676c4f11521f0030 (diff) | |
download | Qt-6f9cd3170d917c8ab3b526d3e4cc33c714e26648.zip Qt-6f9cd3170d917c8ab3b526d3e4cc33c714e26648.tar.gz Qt-6f9cd3170d917c8ab3b526d3e4cc33c714e26648.tar.bz2 |
Use nicer fonts and a few little patches to uikit platform.
Merge-request: 1275
Reviewed-by: con
-rw-r--r-- | src/plugins/platforms/uikit/quikiteventloop.mm | 11 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitintegration.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitintegration.mm | 19 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitwindow.mm | 8 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitwindowsurface.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/uikit.pro | 2 |
6 files changed, 25 insertions, 18 deletions
diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm index 8884f63..c049563 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.mm +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -72,7 +72,8 @@ Q_UNUSED(application) foreach (QWidget *widget, qApp->topLevelWidgets()) { QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); - platformWindow->ensureNativeWindow(); + if (platformWindow) platformWindow->ensureNativeWindow(); + else qDebug() << "Failed to get platform window: " << widget; } return YES; } @@ -156,15 +157,15 @@ bool QUIKitSoftwareInputHandler::eventFilter(QObject *obj, QEvent *event) if (event->type() == QEvent::RequestSoftwareInputPanel) { QWidget *widget = qobject_cast<QWidget *>(obj); if (widget) { - QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); - [platformWindow->nativeView() becomeFirstResponder]; + QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->window()->platformWindow()); + if (platformWindow) [platformWindow->nativeView() becomeFirstResponder]; return true; } } else if (event->type() == QEvent::CloseSoftwareInputPanel) { QWidget *widget = qobject_cast<QWidget *>(obj); if (widget) { - QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); - [platformWindow->nativeView() resignFirstResponder]; + QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->window()->platformWindow()); + if (platformWindow) [platformWindow->nativeView() resignFirstResponder]; return true; } } diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h index 92247fd..d9844b2 100644 --- a/src/plugins/platforms/uikit/quikitintegration.h +++ b/src/plugins/platforms/uikit/quikitintegration.h @@ -64,6 +64,7 @@ public: private: QList<QPlatformScreen *> mScreens; + QPlatformFontDatabase *mFontDb; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm index 737fa40..21ab38f 100644 --- a/src/plugins/platforms/uikit/quikitintegration.mm +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -44,6 +44,7 @@ #include "quikitwindowsurface.h" #include "quikitscreen.h" #include "quikiteventloop.h" +#include "qgenericunixfontdatabase.h" #include <QtGui/QApplication> @@ -55,7 +56,18 @@ QT_BEGIN_NAMESPACE +class QUIKitFontDatabase : public QGenericUnixFontDatabase +{ +public: + virtual QString fontDir() const + { + return QString( [[[[NSBundle mainBundle] bundlePath] + stringByAppendingPathComponent:@"fonts"] UTF8String] ); + } +}; + QUIKitIntegration::QUIKitIntegration() + :mFontDb(new QUIKitFontDatabase() ) { mScreens << new QUIKitScreen(0); } @@ -93,12 +105,7 @@ QPlatformEventLoopIntegration *QUIKitIntegration::createEventLoopIntegration() c QPlatformFontDatabase * QUIKitIntegration::fontDatabase() const { - static bool initialized = false; - if (!initialized) { - initialized = true; - setenv("QT_QPA_FONTDIR",[[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"fonts"] UTF8String],1); - } - return QPlatformIntegration::fontDatabase(); + return mFontDb; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm index 29ca88b..fe29fd6 100644 --- a/src/plugins/platforms/uikit/quikitwindow.mm +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -67,9 +67,8 @@ public: mFormat.setBlueBufferSize(8); mFormat.setAlphaBufferSize(8); mFormat.setStencilBufferSize(8); + mFormat.setSamples(0); mFormat.setSampleBuffers(false); - mFormat.setSamples(1); -// mFormat.setSwapInterval(?) mFormat.setDoubleBuffer(true); mFormat.setDepth(true); mFormat.setRgba(true); @@ -335,9 +334,8 @@ QUIKitWindow::QUIKitWindow(QWidget *tlw) : mScreen = static_cast<QUIKitScreen *>(QPlatformScreen::platformScreenForWidget(tlw)); CGRect screenBounds = [mScreen->uiScreen() bounds]; QRect geom(screenBounds.origin.x, screenBounds.origin.y, screenBounds.size.width, screenBounds.size.height); - setGeometry(geom); - mView = [[EAGLView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; - // TODO ensure the native window if the application is already running + QPlatformWindow::setGeometry(geom); + mView = [[EAGLView alloc] initWithFrame:CGRectMake(geom.x(), geom.y(), geom.width(), geom.height())]; } QUIKitWindow::~QUIKitWindow() diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.mm b/src/plugins/platforms/uikit/quikitwindowsurface.mm index 54723f8..809f098 100644 --- a/src/plugins/platforms/uikit/quikitwindowsurface.mm +++ b/src/plugins/platforms/uikit/quikitwindowsurface.mm @@ -127,7 +127,7 @@ void QUIKitWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QP QWindowSurface::WindowSurfaceFeatures QUIKitWindowSurface::features() const { - return PartialUpdates; + return 0; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/uikit.pro b/src/plugins/platforms/uikit/uikit.pro index 6f5947f..273c00d 100644 --- a/src/plugins/platforms/uikit/uikit.pro +++ b/src/plugins/platforms/uikit/uikit.pro @@ -22,6 +22,6 @@ HEADERS = quikitsoftwareinputhandler.h #add libz for freetype. LIBS += -lz -#include(../fontdatabases/basicunix/basicunix.pri) +include(../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target |