Developer Documentation
PluginFunctionsQtWidget.cc
1 
2 /*===========================================================================*\
3 * *
4 * OpenFlipper *
5  * Copyright (c) 2001-2015, RWTH-Aachen University *
6  * Department of Computer Graphics and Multimedia *
7  * All rights reserved. *
8  * www.openflipper.org *
9  * *
10  *---------------------------------------------------------------------------*
11  * This file is part of OpenFlipper. *
12  *---------------------------------------------------------------------------*
13  * *
14  * Redistribution and use in source and binary forms, with or without *
15  * modification, are permitted provided that the following conditions *
16  * are met: *
17  * *
18  * 1. Redistributions of source code must retain the above copyright notice, *
19  * this list of conditions and the following disclaimer. *
20  * *
21  * 2. Redistributions in binary form must reproduce the above copyright *
22  * notice, this list of conditions and the following disclaimer in the *
23  * documentation and/or other materials provided with the distribution. *
24  * *
25  * 3. Neither the name of the copyright holder nor the names of its *
26  * contributors may be used to endorse or promote products derived from *
27  * this software without specific prior written permission. *
28  * *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
31  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
32  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
33  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
34  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
35  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
36  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
37  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
38  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
39  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
40 * *
41 \*===========================================================================*/
42 
43 /*===========================================================================*\
44 * *
45 * $Revision$ *
46 * $LastChangedBy$ *
47 * $Date$ *
48 * *
49 \*===========================================================================*/
50 
51 
52 
53 
54 //=============================================================================
55 //
56 // Plugin Functions for QtWidgets
57 //
58 //=============================================================================
59 
61 
63 
65 
66 namespace PluginFunctions {
67 
68 // ===============================================================================
69 // Get objects
70 // ===============================================================================
71 
72 bool getObject( int _identifier , QtWidgetObject*& _object ) {
73 
74  if ( _identifier == BaseObject::NOOBJECT ) {
75  _object = 0;
76  return false;
77  }
78 
79  // Get object by using the map accelerated plugin function
80  BaseObjectData* object = 0;
81  PluginFunctions::getObject(_identifier,object);
82 
83  _object = dynamic_cast< QtWidgetObject* >(object);
84  return ( _object != 0 );
85 }
86 
87 
88 // ===============================================================================
89 // Getting data from objects and casting between them
90 // ===============================================================================
92 
93  if ( _object->dataType(DATA_QT_WIDGET) ) {
94  QtWidgetObject* object = dynamic_cast< QtWidgetObject* >(_object);
95  return object->qtWidgetNode();
96  } else
97  return 0;
98 }
99 
100 
102  if ( ! _object->dataType(DATA_QT_WIDGET) )
103  return 0;
104  return dynamic_cast< QtWidgetObject* >( _object );
105 }
106 
107 }
QtWidgetNode * qtWidgetNode(BaseObjectData *_object)
Get a QtWidgetNode from an object.
bool getObject(int _identifier, BSplineCurveObject *&_object)
bool dataType(DataType _type) const
Definition: BaseObject.cc:232
static int NOOBJECT
Definition: BaseObject.hh:118
ACG::SceneGraph::QtWidgetNode * qtWidgetNode()
Get the scenegraph Node.
#define DATA_QT_WIDGET
Definition: QtWidget.hh:65
QtWidgetObject * qtWidgetObject(BaseObjectData *_object)
Cast an BaseObject to a QtWidgetObject if possible.