Module vrWidget :: Class vrWidget
[frames] | no frames]

Class vrWidget

   object --+        
            |        
  ??.instance --+    
                |    
vrAEBase.vrAEBase --+
                    |
                   vrWidget

Create a qt gui from a type or an ui xml file.

Examples:

       Example widget.py
       
       def returnPressed():
           print 'Pressed return in linedit!'
       
       def textChanged(text):
           print 'Changed lineedit test to', text
       
       def toggledCheckBox(s):
           print 'Toggled checkbox to', s
       
       def clickedButton():
           print 'Clicked button1!'
       
       def valueChanged1(v):
           print 'Changed spinbox value to', v
       
       def valueChanged2(v):
           print 'Changed slider value to', v
       
       widget = vrWidget("gui/test.ui")
       widget.connect("_lineedit", "returnPressed()", returnPressed)
       widget.connect("_lineedit", "textChanged(const QString &)", textChanged)
       #widget.connect("_checkbox", "toggled(bool)", toggledCheckBox)
       widget.connect("_button", "clicked()", clickedButton)
       widget.connect("_button", "clicked()", "print 'Clicked button2!'")
       widget.connect("_spinbox", "valueChanged(int)", valueChanged1)
       widget.connect("_slider", "valueChanged(int)", valueChanged2)
       
       # creates a new widget2 instance from checkbox, just a test ...
       checkbox = findQObject(widget.getQObject(), "_checkbox")
       widget2 = vrWidget(checkbox)
       widget2.connect("_checkbox", "toggled(bool)", toggledCheckBox)
       
       lineedit = findQObject(widget.getQObject(), "_lineedit")
       lineedit.setProperty("text", "Hallo")
       print "lineedit enabled = ", lineedit.getProperty("enabled")
       print "lineedit text = ", lineedit.getProperty("text")
       
       # create a qtext widget
       text = vrWidget("QTextEdit", vrQObject(), "text edit")
       text.getQObject().setProperty("caption", "TextEditor Test")
       text.getQObject().setProperty("text", "Hi!")
Instance Methods
 
__init__(object, uifile, className, parent, name)
The constructor of the vrVideoGrab class.
bool
connect(sender, signal, function)
Connects widget signals with python functions.
vrQObject
getQObject()
Returns a vrQObject.
 
setToolWindow(state)
Converts it to a floating tool window.
 
show(state)
Shows the widget.

Inherited from vrAEBase.vrAEBase: __reduce__, addLoop, callAllConnected, connectSignal, emitSignal, getModuleName, isActive, loop, recEvent, removeConnections, setActive, setUpdateGUIEnabled, subLoop

Inherited from unreachable.instance: __new__

Class Variables
  __instance_size__ = 152
Method Details

__init__(object, uifile, className, parent, name)
(Constructor)

 

The constructor of the vrVideoGrab class. There are three valid sets of parameters:

vrWidget(object) Creates a vrWidget object from a vrQObject.

vrWidget(uifile) Creates a vrWidget object from a ui xml file, created with QDesigner.

vrWidget(className, parent, name) Creates a vrWidget from a qt classname.

Parameters:
  • object (vrQObject) - The QObject.
  • uifile (string) - The name of the ui xml file.
  • className (string) - The name of the QT class.
  • parent (vrQObject) - The parent QObject.
  • name (string) - The name of the newly created widget.
Overrides: vrAEBase.vrAEBase.__init__

connect(sender, signal, function)

 

Connects widget signals with python functions.

Parameters:
  • sender (string) - The name of the sender.
  • signal (string) - The name of the signal.
  • function (boost::python::object) - The python function.
Returns: bool
Success/Failure.
Overrides: vrAEBase.vrAEBase.connect

getQObject()

 

Returns a vrQObject.

Returns: vrQObject
The QObject.

setToolWindow(state)

 

Converts it to a floating tool window.

Parameters:
  • state (bool) - true tool windows - false normal window.

show(state)

 

Shows the widget.

Parameters:
  • state (integer) - The state: 1 = Show, 0 = Hide, -1 = Toggle.