summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/sensors/creating.cpp
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2010-03-08 13:42:18 +1000
committerLincoln Ramsay <lincoln.ramsay@nokia.com>2010-03-08 13:42:56 +1000
commit98a5e032e94ba77bb67a615e2042462b5e6f2923 (patch)
tree2a344b2d3d08bbc77d4b5ac3228b7c65a89bb1d3 /doc/src/snippets/sensors/creating.cpp
parentac758f6ec4667e22e62be4dd6a25975112abc972 (diff)
replace \code blocks with \snippet statements.
This will let the compiler notify us when our example snippets are no longer valid.
Diffstat (limited to 'doc/src/snippets/sensors/creating.cpp')
-rw-r--r--doc/src/snippets/sensors/creating.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/src/snippets/sensors/creating.cpp b/doc/src/snippets/sensors/creating.cpp
new file mode 100644
index 0000000000..30d8503610
--- /dev/null
+++ b/doc/src/snippets/sensors/creating.cpp
@@ -0,0 +1,22 @@
+#include <QWidget>
+#include <qaccelerometer.h>
+#include <qorientationsensor.h>
+
+QTM_USE_NAMESPACE
+
+class MyWidget : public QWidget
+{
+ void create();
+};
+
+void MyWidget::create()
+{
+//! [Creating a sensor]
+// On the heap (deleted when this object is deleted)
+QAccelerometer *sensor = new QAccelerometer(this);
+
+// On the stack (deleted when the current scope ends)
+QOrientationSensor orient_sensor;
+//! [Creating a sensor]
+}
+