MeVisLab Scripting Reference
|
#include <mlabPythonWidgetControl.h>
Inherits MLABSimpleWidgetControl.
Public Slots | |
Scripting method that are useful for creating own Python MDL controls | |
| |
QVariant | object () |
QWidget * | createChildWidget (MLABTree *tree, QWidget *parent=nullptr) |
MLABTree * | findTree (const QString &name) |
QString | findTreeStringValue (const QString &name, const QString &defaultValue=QString()) |
int | findTreeIntValue (const QString &name, int defaultValue=0) |
double | findTreeDoubleValue (const QString &name, double defaultValue=0.) |
bool | findTreeBoolValue (const QString &name, bool defaultValue=false) |
MLABField * | lookupField (MLABTree *tree) |
void | addFieldListener (MLABField *field, PyObject *callable) |
MLABPythonWidgetControlCommand * | addCommand (MLABTree *tree) |
QMenu * | createMenu (MLABTree *tree, QWidget *owner) |
Public Slots inherited from MLABWidgetControl | |
void | adjustSize () |
virtual void | setEnabled (bool flag) |
virtual void | setVisible (bool flag) |
virtual bool | isVisible () |
virtual void | setFocus () |
virtual bool | hasFocus () |
virtual void | setToolTip (const QString &string) |
virtual void | setWhatsThis (const QString &string) |
void | displayWhatsThis () |
void | displayWhatsThis (const QString &text) |
virtual void | setTitle (const QString &) |
QWidget * | widget () |
QLayout * | layout () |
virtual QString | windowHandle () |
virtual bool | createScreenshot (const QString &filename, bool grabFromScreen=true, bool scaleToLowRes=false) |
bool | isReloadable () const |
void | reload (MLABTree *tree) |
QString | createGlobalScreenshot () |
QString | applicationName () |
QSize | size () |
int | width () |
int | height () |
int | minWidth () |
int | minHeight () |
int | maxWidth () |
int | maxHeight () |
virtual void | setMinWidth (int s) |
virtual void | setMinHeight (int s) |
void | setMaxWidth (int s) |
void | setMaxHeight (int s) |
QSize | sizeHint () |
QSize | minSize () |
QSize | maxSize () |
void | setMinSize (QSize size) |
void | setMaxSize (QSize size) |
void | updateLayout () |
int | windowID () |
MLABWidgetControl * | control (const QString &name) |
float | scaleFactor () |
MLABModule * | module () |
QString | getType () |
QString | getName () |
bool | acceptDrops () |
void | setAcceptDrops (bool flag) |
void | raiseWidget () |
void | setStyleSheetFromString (const QString &styleSheetText) |
void | setStyleSheetFromFile (const QString &styleSheetFileName) |
MLABTree * | tree () |
void | updateMaxSize () |
bool | expandX () |
bool | expandY () |
MLABTreePtr | getDefaultTagValues () const |
virtual bool | hasUncommittedChanges () const |
virtual void | applyUncommittedChanges () |
virtual void | revertUncommittedChanges () |
MLABField * | field () const |
Python widget control.
The python widget control takes ownership if a Python object instance and delegates the C++ calls to the Python code.
The python instance needs to implement a method named:
where control is the owning MLABPythonWidgetControl and parent it the parent QWidget.
If the control should have MDL children, implement a
method and use MLABPythonWidgetControl::createChildWidget() to create child widgets.
If you want to know when your control gets destroyed, implement:
|
slot |
add a scripting command for the given tree.
The returned object has a MLABPythonWidgetControlCommand::call() method which can be called to emit the command (and thus call the attached scripting function with the arguments passed to call). Currently only up to 4 arguments are supported.
|
slot |
add a fieldlistener for the given field (field can be read from an MDL tree using lookupField())
|
slot |
Create a child widget from given MDL tree, the returned widget needs to be added to a Qt layout.
If no parent is given, the main widget of the control is used. This should only be called from the setupChildren() Python method.
|
slot |
create a QMenu from MDL SubMenu items given in tree.
|
slot |
Searches inside the MDL tree of the control (including the MDL prototype definition for that control) and returns the first tree with given name (case insensitive).
For more complex searches, you can directly access the MDL tree via MLABWidgetControl::tree().
|
slot |
Searches inside the MDL tree of the control (including the MDL prototype definition for that control) and returns the first tree's double value with given name (case insensitive).
|
slot |
Searches inside the MDL tree of the control (including the MDL prototype definition for that control) and returns the first tree's double value with given name (case insensitive).
|
slot |
Searches inside the MDL tree of the control (including the MDL prototype definition for that control) and returns the first tree's integer value with given name (case insensitive).
|
slot |
Searches inside the MDL tree of the control (including the MDL prototype definition for that control) and returns the first tree's value with given name (case insensitive).
lookup the field given by the value of the passed tree
|
slot |
return the python object for scripting