aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2013-01-07 22:54:22 +0100
committerMorten Johan Sørvig <morten.sorvig@digia.com>2013-01-31 08:52:58 +0100
commit6a581f54b8e7b24759c167837fd4e4f550fe1a91 (patch)
tree12dc144eaf0df5e416cb8ecccbd99e8a6227354b /examples
parent8a6721e4240fdf693955bbbc7bc60d58fbf158a5 (diff)
Add to/fromMacCGImageRef example.
Change-Id: I608d5dab794972c809dcb0c31d97411ebd36f35e Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/macfunctions/macfunctions.pro3
-rw-r--r--examples/macfunctions/macfunctions.qrc5
-rw-r--r--examples/macfunctions/main.cpp6
-rw-r--r--examples/macfunctions/qtlogo.pngbin0 -> 1478 bytes
4 files changed, 14 insertions, 0 deletions
diff --git a/examples/macfunctions/macfunctions.pro b/examples/macfunctions/macfunctions.pro
index c4a4ad1..4c86a7f 100644
--- a/examples/macfunctions/macfunctions.pro
+++ b/examples/macfunctions/macfunctions.pro
@@ -8,3 +8,6 @@ include (../../src/qtmacextras.pri)
# Input
SOURCES += main.cpp
+
+RESOURCES += \
+ macfunctions.qrc
diff --git a/examples/macfunctions/macfunctions.qrc b/examples/macfunctions/macfunctions.qrc
new file mode 100644
index 0000000..04a9419
--- /dev/null
+++ b/examples/macfunctions/macfunctions.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qtlogo.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/macfunctions/main.cpp b/examples/macfunctions/main.cpp
index d049b76..9e0b466 100644
--- a/examples/macfunctions/main.cpp
+++ b/examples/macfunctions/main.cpp
@@ -47,10 +47,16 @@ int main(int argc, char **argv)
QWidget widget;
widget.show();
+ // Dock menu
QMenu menu;
menu.addAction("Item 1");
menu.addAction("Item 2");
qt_mac_set_dock_menu(&menu);
+ // Pixmap <-> CGImage conversion
+ QPixmap pixmap(":qtlogo.png");
+ CGImageRef cgImage = toMacCGImageRef(pixmap);
+ QPixmap pixmap2 = fromMacCGImageRef(cgImage);
+
return app.exec();
}
diff --git a/examples/macfunctions/qtlogo.png b/examples/macfunctions/qtlogo.png
new file mode 100644
index 0000000..d75936b
--- /dev/null
+++ b/examples/macfunctions/qtlogo.png
Binary files differ