summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoahelpers.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-02-141-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/concurrent/doc/qtconcurrent.qdocconf src/corelib/doc/qtcore.qdocconf src/corelib/global/qglobal.h src/dbus/doc/qtdbus.qdocconf src/dbus/qdbusmessage.h src/gui/doc/qtgui.qdocconf src/gui/image/qimagereader.cpp src/network/doc/qtnetwork.qdocconf src/opengl/doc/qtopengl.qdocconf src/opengl/qgl.h src/plugins/platforms/windows/qwindowswindow.cpp src/printsupport/doc/qtprintsupport.qdocconf src/sql/doc/qtsql.qdocconf src/testlib/doc/qttestlib.qdocconf src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf src/widgets/doc/qtwidgets.qdocconf src/xml/doc/qtxml.qdocconf Change-Id: Ie9a1fa2cc44bec22a0b942e817a1095ca3414629
| * Cocoa: Export QImage <-> CGImage conversion funcs.Morten Johan Sørvig2013-02-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For implementing to/fromMacCGImageRef in QtMacExtras. These do not depend on internal Qt state. The main reason for exporting them is to keep the implementation in one place to ease maintenance. Refactor qt_mac_cg_context to support QImage. Add qt_mac_toQImage. Change-Id: Ia9c226ed52d087b2c6b47aa8210ed8f2645b9cf2 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove usage of qt_mac_get_scaleFactor() as it is no longer neededAndy Shaw2012-12-191-2/+0
|/ | | | | | | | | qt_mac_get_scaleFactor() uses a deprecated function, but as this function is no longer needed internally anyway, just remove it. Task-number: QTBUG-28574 Change-Id: I4e3cd2383ecc56aa6f9e3931a1806c62b1cedeb5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: QGLWidget draws wrong within QMainWindow on Mac OSRichard Moe Gustavsen2012-11-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The resons for this bug is that Qt can share the same backingstore between several windows (if they exist in the same hierarchy), but this was just not supported by the Cocoa plugin. This patch will make sure that we pay attention to which window the QCocoaBackingStore is told to flush, and forward this information to the QNSView that backs it up. Inside the views drawRect function we then take some extra steps to get the correct sub-part of the possibly shared backingstore image. This patch also does some effort to ensure that we recreate the backingstore image as little as possible, as we can often get several resizes to the backingstore before we actually draw anything. Moreover, by being a bit careful on how we tell UiKit to update the view upon a flush, we can minimize the number of drawRect calls (and then CGImageRef creations) we need to do. This patch actually ends up improving resize/repaint performance a lot as well. QT-BUG: 27390 Change-Id: I2c2a26b149fa855411b6bff8b9cc9a61694ae72f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* Compile with -no-widgets.Morten Johan Sorvig2012-11-191-0/+3
| | | | | | | | | | | | | | Remove QApplication usage in qcocoasystemtrayicon.mm Move qt_mac_cg_context from qpaintengine_mac.mm to qcocoahelpers.mm to make it available in no-widgets builds. (Move qt_mac_colorSpaceForDeviceType as well; color space support needs to be cleaned up later on.) Change-Id: I724fdb09538d65eae56c26165f3ba53b6814ea78 Reviewed-by: Liang Qi <liang.qi@digia.com>
* Support native event filter for Mac OS XLiang Qi2012-11-091-0/+28
| | | | | | | | | | | Ported from Qt 4 implementation, updated with QAbstractEventDispatcher::filterNativeEvent() call. Tested with an example. Change-Id: I3271f8a565d06d80b7b48ba81728bcdb7b1c32e3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Set platform window geometry correctly.Morten Johan Sorvig2012-10-161-0/+3
| | | | | | | | | | | | Handle the non-toplevel child window case, where QWindow has a parent NSView instead of a parent NSWindow. QWindow geometry is then equivalent to the frame geometry Task-number: QTBUG-26972 Change-Id: Ie7cedb3ec1a564ce55b72e8269d4853962e073ce Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Platform-plugin support for QSystemTrayIcon.Christoph Schleifenbaum2012-07-031-0/+6
| | | | | | | | | | | | | | | | | | | | | Implement QPlatformSystemTrayIcon providing QPA-plugin-support for system tray icons. Make QSystemTrayIcon use this as new backend. Ported over qsystemtrayicon_mac.mm to qcocoasystemtrayicon.mm to provide Cocoa support for the new interface. It had to be changed to match the interface, especially for icon and menu handling. This interface is made to not use QStyle or QMenu which are related classes of QSystemTrayIcon. It's therefore not introducing QtWidget dependency into the platform plugin. Task-number: QTBUG-20978 Change-Id: I0d0a73835698b3b4f97219d4f5bbcfa2af57dbe2 Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Cocoa implementation of QPA menu interface.James Turner2012-05-191-0/+5
| | | | | | | | | | | Implement the QPA platform menu interface for Cocoa, including native menubar support and merging with the predefined menus created from the bundled .nib. Cleanup code previously used to maintain the menus, and add a manual test of the menus code. Change-Id: Ia99267ddb6485e18e05c540eb32c5aee6cbb85db Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Port QMacPrintEngine and QCoreGraphicsPaintEngine from Qt 4 to Qt 5Bradley T. Hughes2012-03-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Copy qprintengine_mac_p.h, qprintengine_mac.mm, qpaintengine_mac_p.h, and qpaintengine_mac.cpp (as qpaintengine_mac.mm) from src/gui/painting/ in the 4.8 branch of http://git.gitorious.org/qt/qt.git at commit e6bd33d4aef0e4538d7918e7ab130624c911b553. The following changes are necessary to port these files to the Qt 5 API: - The copyright notice on these files has been updated to match the header.LGPL template. - Fix #includes for qprintengine_mac* and qpaintengine_mac*, as some headers have moved in Qt 5. - Remove extern forward declarations for functions that no longer exist. - Remove friend declarations for classes/functions that are not part of the Cocoa platform plugin. - Remove QT_MAC_USE_COCOA blocks. Qt is always using Cocoa now, there is no need to keep the non-Cocoa code paths anymore. The QMacPrintEngine::shouldSuppressStatus() method was also removed, since it is no longer used. - Do not use Qt::UniteClip, it was removed in commit 01b72952c38b9193138eabdab6bdab632cd75ebd - Use QCocoaAutoReleasePool in qprintengine_mac.mm - Use QPlatformPrintSupport::convert*() functions in QMacPrintEngine, since we cannot use non-exported functions from QtPrintSupport in the Cocoa plugin. - Use qt_mac_image_to_cg_image() to convert QPixmap to CGImageRef. First convert QPixmap to QImage (cheap, since the Cocoa platform plugin uses QRasterPlatformPixmap), and then convert the QImage to CFImageRef using the existing helper function. - Copy qt_mac_cg_context() to the Cocoa platform plugin from qmacstyle_mac.mm, adding a note at each location about the duplication. - Add qt_mac_QRegionToHIMutableShape() helper. Adapt the Qt 4.x code for QRegion::toHIMutableShape(), and use this in QCoreGraphicsPaintEngine. - Add qt_mac_drawCGImage() and qt_mac_get_scalefactor() helper. These functions are copied directly from the 4.8 branch of http://git.gitorious.org/qt/qt.git at the same revision shown above. - Add qt_mac_create_imagemask() helper in qpaintengine_mac.cpp. This helper is based on the function with the same name from the 4.8 branch of http://git.gitorious.org/qt/qt.git at the same revision shown above. The correctness of the implementation has not yet been verified. Since these files use the QPrinter API from QtPrintSupport, the Cocoa plugin now needs to link to that library as well. Change-Id: I90b9bbe201327489ef9e1b3294e68e91ddda27bd Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Input method on MacTasuku Suzuki2012-03-121-0/+2
| | | | | | | | Restore input method implimentation in Qt4 Task-number: QTBUG-23867 Change-Id: I5d405ccc8b0a73c399d992f6474a0cc38d191157 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: Implement Drag-and-Drop.Friedemann Kleint2012-03-071-0/+5
| | | | | | | | | | Implement drag and drop support for drags originating from outside Qt. Port mime and pasteboard code from Qt 4. Use QSimpleDrag from from platform support to implement internal Qt drags. Change-Id: I5b664a95ebb00f48de2bd21c24dfb579af16123e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Move QString <-> NSString conversion to QtCoreMorten Johan Sorvig2012-02-021-6/+0
| | | | | | | | | | | | | | | | Add (private) API to QCFString: static QString toQString(NSString *) static NSString *toNSString(const QString &) Add implementation to qcore_mac_objc.mm. Keep the mac_cpp since it's used for building qmake as well as bootstrapping. Replace usage of NSString conversion functions in the cocoa and corewlan plugin with QCFString. Change-Id: I9f34edd5231255aef9d8d6e9a60306174bb279b3 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Avoid non-standard indentation of license headers.Jason McDonald2012-01-301-39/+39
| | | | | | | | The strange indentation has made maintenance of license headers difficult on several occasions. Change-Id: Ib29a7e5275e2c7a2c13a3f32fd2479f34d3353ca Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Delete src/widgets/platforms/macMorten Johan Sorvig2012-01-171-2/+1
| | | | | | | | This looks like the mac port but isn't any more, remove it to prevent confusion. Change-Id: I498f536d77d1a3c53e687f696ca6992539a1a90b Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fixed Qtbase OSX specific namespace compilation.Toby Tomkins2011-11-291-0/+4
| | | | | | Change-Id: Idacfa679df7aa6417f8017f80928907830d15df2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cocoa: Set correct child window geometry.Morten Sorvig2011-10-271-0/+1
| | | | | | | | | Remote globalGeometry which was completely wrong, replace with flipRect which converts from Qt screen coordinates to OS X screen coordinates. Change-Id: Ie560cb7c2266fe779da8a44a35596d2d12af77f5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: Implement propagateSizeHints.Morten Sorvig2011-10-271-0/+2
| | | | | Change-Id: Idc1244ffbf975972f01d9ee48092500a72739d37 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: Add helper functions for NSPoint <-> QPoint(F) conversion.Bjørn Erik Nilsen2011-09-201-0/+17
| | | | | | | | | | ... and use [NSEvent mouseLocation] as global mouse position rather than relying on QCursor::pos() (which is buggy at the moment). Change-Id: Ieb8000089d0d824bed89abd8b2add9e28273f227 Reviewed-on: http://codereview.qt-project.org/5254 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bjørn Erik Nilsen <bjorn.nilsen@nokia.com>
* Clang Build Fix: Cocoa platform pluginTakumi ASAKI2011-09-091-1/+1
| | | | | | | | | | Fix some assignment from const values to non-const without cast. Move #import to avoid compile error. Fix type mismatch. Change-Id: I93ae5cd07827b92a91093df979992616b26b14af Reviewed-on: http://codereview.qt-project.org/4536 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: QMenu refactor.Morten Sorvig2011-09-071-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change prepares for enabling native menus on OS X. Move code from src/widgets to cocoa: - qcocoaapplicaiton - qcocoaapplicaitondelegate - qcocoamenuloader - qcocoamenu - qmenu_mac - misc helpers to qcocoahelpers Create a QNSApplication and QCocoaApplicationDelegate at application startup. New Lighthouse API: - class QPlatformMenu - class QPlatformMenuBar - QPlatformIntegration::createPlatformMenu() - QPlatformIntegration::createPlatformMenuBar() Platforms that wants a native menu integration subclasses QPlatformMenu[|Bar] and implements the create function. The default implementation returns 0, which causes QMenu to use the standard Qt menus. This API is based on the current native menu abstraction that Mac, Wince and S60 uses in Qt 4. The main difference is that the platform classes are proper standalone classes and not #ifdeffed into QMenuPrivate. Change-Id: I3da41f80b0ae903a476937908b1f9b88014b7954 Reviewed-on: http://codereview.qt.nokia.com/4068 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Make plain executables foreground processes.Morten Sorvig2011-08-291-0/+81
Non-bundled executables are started as background processes which does not have a dock icon or a task switcher entry. This is generally not what we want for Qt gui applications so change the process type. Change-Id: I0d29eb9b70655e95bc0b9500803fbf3955d264e4 Reviewed-on: http://codereview.qt.nokia.com/3387 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>