MeVisLab Scripting Reference
MLABWidgetControl Class Reference

Inherits QObject.

Inherited by MLABAccelControl, MLABColorEditControl, MLABCommonButtonGroupControl, MLABDicomBrowserTableControl, MLABEmptyControl, MLABEventFilterControl, MLABFieldControl, MLABFieldListControl, MLABFieldListenerControl, MLABFreeFloatControl, MLABGridControl, MLABIntervalSliderControl, MLABInventorMaterialEditorControl, MLABKeyFrameEditorControl, MLABLogControl, MLABMenuBarControl, MLABNetworkViewControl, MLABNumberControl, MLABPackageManagerControl, MLABPathBrowserControl, MLABPopupMenuControl, MLABProgressBarControl, MLABScriptConsoleControl, MLABShortcutEditorControl, MLABSimpleWidgetControl, MLABSliderControl, MLABTabViewControl, MLABTextViewControl, MLABThumbWheelControl, MLABVectorControl, and MLABWindowControl.

Public Slots

Scripting access.
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 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 ()
 
MLABWidgetControlcontrol (const QString &name)
 
float scaleFactor ()
 
MLABModulemodule ()
 
QString getType ()
 
QString getName ()
 
bool acceptDrops ()
 
void setAcceptDrops (bool flag)
 
void raiseWidget ()
 
void setStyleSheetFromString (const QString &styleSheetText)
 
void setStyleSheetFromFile (const QString &styleSheetFileName)
 
MLABTreetree ()
 
void updateMaxSize ()
 
bool expandX ()
 
bool expandY ()
 
MLABTreePtr getDefaultTagValues () const
 
virtual bool hasUncommittedChanges () const
 
virtual void applyUncommittedChanges ()
 
virtual void revertUncommittedChanges ()
 
MLABFieldfield () const
 

Detailed Description

Base class for controls in MLAB.

This base class offers a number of methods that can be called from scripting to change its state.

Member Function Documentation

bool MLABWidgetControl::acceptDrops ( )
inlineslot

Returns whether the control accepts drops.

void MLABWidgetControl::adjustSize ( )
slot

Adjusts the widget size according to its size hint.

QString MLABWidgetControl::applicationName ( )
slot

Returns the name of the application macro this module is in.

virtual void MLABWidgetControl::applyUncommittedChanges ( )
inlinevirtualslot

Apply uncommitted changes.

Reimplemented in MLABTextViewControl.

MLABWidgetControl* MLABWidgetControl::control ( const QString &  name)
slot

Returns a named control in the context of this control.

QString MLABWidgetControl::createGlobalScreenshot ( )
slot

Creates a global screenshot which goes to the screenshot gallery.

If successful, it also creates a thumb nail and returns the file name.

virtual bool MLABWidgetControl::createScreenshot ( const QString &  filename,
bool  grabFromScreen = true 
)
virtualslot

Creates a snapshot in the given filename with the specified format.

The area that is grabbed will not contain the mouse cursor, but any other windows that are in front of this control will also be grabbed. This method is also able to grab Open Inventor viewers with their current OpenGL image.

the format is read from the given extension, available formats are:

  • ".png" (PNG RGB)
  • ".tif",".tiff" (TIFF RGB)

    Example:

    ctx.control("nameofyourcontrol").createScreenshot("c:/test.png")

Reimplemented in MLABInventorViewerControl.

void MLABWidgetControl::displayWhatsThis ( )
slot

Shows the Whats This text for the control (using the MDL whatsThis tag).

void MLABWidgetControl::displayWhatsThis ( const QString &  text)
slot

Displays the given richtext on this control.

bool MLABWidgetControl::expandX ( )
inlineslot

Returns whether the control should expand horizontally.

bool MLABWidgetControl::expandY ( )
inlineslot

Returns whether the control should expand vertically.

MLABField* MLABWidgetControl::field ( ) const
inlineslot

Return the field edited/displayed by this control.

Returns
None if no field was or can be set for this control.
MLABTreePtr MLABWidgetControl::getDefaultTagValues ( ) const
slot

Returns a tree containing default tag values which have not been specified.

Tags that do not have a simple default value or string tags are excluded.

QString MLABWidgetControl::getName ( )
inlineslot

Returns the name of the control which has been set via "name" or "instanceName" tag.

QString MLABWidgetControl::getType ( )
inlineslot

Returns the type of the control, e.g., "MLABLabelControl" for a label.

virtual bool MLABWidgetControl::hasFocus ( )
inlinevirtualslot

Returns whether this control has the keyboard focus.

virtual bool MLABWidgetControl::hasUncommittedChanges ( ) const
inlinevirtualslot

Return true if this control has uncommitted changes (currently only applies to TextView control)

Reimplemented in MLABTextViewControl.

int MLABWidgetControl::height ( )
inlineslot

Returns the height of the widget.

bool MLABWidgetControl::isReloadable ( ) const
inlineslot

Returns whether this control can be reloaded with a new tree.

This is used by the GUI editor to partly update panels.

virtual bool MLABWidgetControl::isVisible ( )
virtualslot

Returns whether this control is visible.

QLayout* MLABWidgetControl::layout ( )
inlineslot

Returns the layout of the main QWidget of this control (this widget may be different depending on tags used in the control).

int MLABWidgetControl::maxHeight ( )
inlineslot

Returns the maximum height of the widget.

QSize MLABWidgetControl::maxSize ( )
inlineslot

Returns the maximum size of the widget.

int MLABWidgetControl::maxWidth ( )
inlineslot

Returns the maximum width of the widget.

int MLABWidgetControl::minHeight ( )
inlineslot

Returns the minimum height of the widget.

QSize MLABWidgetControl::minSize ( )
inlineslot

Returns the minimum size of the widget.

int MLABWidgetControl::minWidth ( )
inlineslot

Returns the minimum width of the widget.

MLABModule* MLABWidgetControl::module ( )
inlineslot

Returns the module associated with this GUI element.

void MLABWidgetControl::raiseWidget ( )
slot

Raises the underlying widget (can not be called raise because raise() is a keyword in python).

void MLABWidgetControl::reload ( MLABTree tree)
slot

Reloads this control with the new tree if isReloadable() returns true.

virtual void MLABWidgetControl::revertUncommittedChanges ( )
inlinevirtualslot

Revert uncommitted changes; this mainly exists to prevent a second request dialog opening on closing if changes were discarded in the shouldCloseCommand.

Reimplemented in MLABTextViewControl.

float MLABWidgetControl::scaleFactor ( )
inlineslot

Returns the GUI scale factor for this widget.

void MLABWidgetControl::setAcceptDrops ( bool  flag)
inlineslot

Sets whether the control accepts drops.

virtual void MLABWidgetControl::setEnabled ( bool  flag)
virtualslot

Enables/disables the control.

virtual void MLABWidgetControl::setFocus ( )
inlinevirtualslot

Sets the keyboard focus.

void MLABWidgetControl::setMaxHeight ( int  s)
inlineslot

Sets the maximum height of the widget.

void MLABWidgetControl::setMaxSize ( QSize  size)
inlineslot

Sets the maximum size of the widget.

void MLABWidgetControl::setMaxWidth ( int  s)
inlineslot

Sets the maximum width of the widget.

virtual void MLABWidgetControl::setMinHeight ( int  s)
inlinevirtualslot

Sets the minimum height of the widget.

Reimplemented in MLABWindowControl.

void MLABWidgetControl::setMinSize ( QSize  size)
inlineslot

Sets the minimum size of the widget.

virtual void MLABWidgetControl::setMinWidth ( int  s)
inlinevirtualslot

Sets the minimum width of the widget.

Reimplemented in MLABWindowControl.

void MLABWidgetControl::setStyleSheetFromFile ( const QString &  styleSheetFileName)
slot

Sets the Qt style sheet value from a file.

void MLABWidgetControl::setStyleSheetFromString ( const QString &  styleSheetText)
slot

Sets the Qt style sheet value.

virtual void MLABWidgetControl::setTitle ( const QString &  )
virtualslot

Set the title of the widget (this method is reimplemented in the different widgets).

Please note that this method will be removed in the future, so that it can only be called on derived classes which actually support a title.

Reimplemented in MLABWindowControl.

virtual void MLABWidgetControl::setToolTip ( const QString &  string)
virtualslot

Sets a tool tip text for the control.

virtual void MLABWidgetControl::setVisible ( bool  flag)
virtualslot

Makes the control visible/invisible.

virtual void MLABWidgetControl::setWhatsThis ( const QString &  string)
virtualslot

Sets a Whats This text for the control.

QSize MLABWidgetControl::size ( )
inlineslot

Returns the size of the widget.

QSize MLABWidgetControl::sizeHint ( )
inlineslot

Returns the size hint of the widget.

MLABTree* MLABWidgetControl::tree ( )
inlineslot

Returns the MDL tree for this control.

void MLABWidgetControl::updateLayout ( )
slot

Recursively updates the layout.

You might need to call MLAB.processEvents() afterwards to make sure that the changes take effect completely.

void MLABWidgetControl::updateMaxSize ( )
slot

Updates the maximum size of the widget when expandX/Y == no and the contents have changed size.

QWidget* MLABWidgetControl::widget ( )
inlineslot

Returns the main QWidget of this control (this widget may be different depending on tags used in the control).

int MLABWidgetControl::width ( )
inlineslot

Returns the width of the widget.

virtual QString MLABWidgetControl::windowHandle ( )
virtualslot

Returns the window handle of the underlying QWidget as string encoded in hexadecimal, e.g., "1234ABCD".

int MLABWidgetControl::windowID ( )
inlineslot

Returns the window id for this control.

The windowId can be used on MLABModule::controlForWindowID(id) to get a named control of a specific window.