root/OpenSceneGraph/trunk/src/osgQt/QWidgetImage.cpp @ 12292

Revision 12292, 1.7 kB (checked in by robert, 3 years ago)

Ran svn propset -R svn:eol-style native . on the OpenSceneGraph

  • Property svn:eol-style set to native
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#include <osgQt/QWidgetImage>
15#include <QtGui/QLayout>
16
17namespace osgQt
18{
19
20QWidgetImage::QWidgetImage( QWidget* widget )
21{
22    // make sure we have a valid QApplication before we start creating widgets.
23    getOrCreateQApplication();
24
25    _widget = widget;
26    _adapter = new QGraphicsViewAdapter(this, _widget.data());
27}
28
29bool QWidgetImage::sendFocusHint(bool focus)
30{
31    QFocusEvent event(focus ? QEvent::FocusIn : QEvent::FocusOut, Qt::OtherFocusReason);
32    QCoreApplication::sendEvent(_widget, &event);
33    return true;
34}
35
36void QWidgetImage::clearWriteBuffer()
37{
38    _adapter->clearWriteBuffer();
39}
40
41void QWidgetImage::render()
42{
43    _adapter->render();
44}
45
46void QWidgetImage::scaleImage(int s,int t,int r, GLenum newDataType)
47{
48    _adapter->resize(s, t);
49}
50
51void QWidgetImage::setFrameLastRendered(const osg::FrameStamp* frameStamp)
52{
53    _adapter->setFrameLastRendered(frameStamp);
54}
55
56bool QWidgetImage::sendPointerEvent(int x, int y, int buttonMask)
57{
58    return _adapter->sendPointerEvent(x,y,buttonMask);
59}
60
61bool QWidgetImage::sendKeyEvent(int key, bool keyDown)
62{
63    return _adapter->sendKeyEvent(key, keyDown);
64}
65
66}
Note: See TracBrowser for help on using the browser.