MeVisLab Scripting Reference
MLABWidgetControl Class Reference
Inheritance diagram for MLABWidgetControl:
MLABAccelControl MLABColorEditControl MLABCommonButtonGroupControl MLABDicomBrowserTableControl MLABEmptyControl MLABEventFilterControl MLABFieldControl MLABFieldListenerControl MLABFreeFloatControl MLABGridControl MLABIntervalSliderControl MLABInventorMaterialEditorControl MLABKeyFrameEditorControl MLABLogControl MLABMenuBarControl MLABNetworkViewControl MLABNumberControl MLABPathBrowserControl MLABPopupMenuControl MLABProgressBarControl MLABScriptConsoleControl MLABSimpleWidgetControl MLABSliderControl MLABTabViewControl MLABTextViewControl MLABThumbWheelControl MLABVectorControl 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 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 ()
 
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
 

Friends

class MLABWindowControl
 

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

◆ acceptDrops

bool MLABWidgetControl::acceptDrops ( )
inlineslot

Returns whether the control accepts drops.

◆ adjustSize

void MLABWidgetControl::adjustSize ( )
slot

Adjusts the widget size according to its size hint.

◆ applicationName

QString MLABWidgetControl::applicationName ( )
slot

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

◆ applyUncommittedChanges

virtual void MLABWidgetControl::applyUncommittedChanges ( )
inlinevirtualslot

Apply uncommitted changes.

Reimplemented in MLABTextViewControl.

◆ control

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

Returns a named control in the context of this control.

◆ createGlobalScreenshot

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.

◆ createScreenshot

virtual bool MLABWidgetControl::createScreenshot ( const QString &  filename,
bool  grabFromScreen = true,
bool  scaleToLowRes = false 
)
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.

◆ displayWhatsThis [1/2]

void MLABWidgetControl::displayWhatsThis ( )
slot

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

◆ displayWhatsThis [2/2]

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

Displays the given richtext on this control.

◆ expandX

bool MLABWidgetControl::expandX ( )
inlineslot

Returns whether the control should expand horizontally.

◆ expandY

bool MLABWidgetControl::expandY ( )
inlineslot

Returns whether the control should expand vertically.

◆ field

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.

◆ getDefaultTagValues

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.

◆ getName

QString MLABWidgetControl::getName ( )
inlineslot

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

◆ getType

QString MLABWidgetControl::getType ( )
inlineslot

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

◆ hasFocus

virtual bool MLABWidgetControl::hasFocus ( )
inlinevirtualslot

Returns whether this control has the keyboard focus.

◆ hasUncommittedChanges

virtual bool MLABWidgetControl::hasUncommittedChanges ( ) const
inlinevirtualslot

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

Reimplemented in MLABTextViewControl.

◆ height

int MLABWidgetControl::height ( )
inlineslot

Returns the height of the widget.

◆ isReloadable

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.

◆ isVisible

virtual bool MLABWidgetControl::isVisible ( )
virtualslot

Returns whether this control is visible.

◆ layout

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).

◆ maxHeight

int MLABWidgetControl::maxHeight ( )
inlineslot

Returns the maximum height of the widget.

◆ maxSize

QSize MLABWidgetControl::maxSize ( )
inlineslot

Returns the maximum size of the widget.

◆ maxWidth

int MLABWidgetControl::maxWidth ( )
inlineslot

Returns the maximum width of the widget.

◆ minHeight

int MLABWidgetControl::minHeight ( )
inlineslot

Returns the minimum height of the widget.

◆ minSize

QSize MLABWidgetControl::minSize ( )
inlineslot

Returns the minimum size of the widget.

◆ minWidth

int MLABWidgetControl::minWidth ( )
inlineslot

Returns the minimum width of the widget.

◆ module

MLABModule* MLABWidgetControl::module ( )
inlineslot

Returns the module associated with this GUI element.

◆ raiseWidget

void MLABWidgetControl::raiseWidget ( )
slot

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

◆ reload

void MLABWidgetControl::reload ( MLABTree tree)
slot

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

◆ revertUncommittedChanges

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.

◆ scaleFactor

float MLABWidgetControl::scaleFactor ( )
inlineslot

Returns the GUI scale factor for this widget.

◆ setAcceptDrops

void MLABWidgetControl::setAcceptDrops ( bool  flag)
inlineslot

Sets whether the control accepts drops.

◆ setEnabled

virtual void MLABWidgetControl::setEnabled ( bool  flag)
virtualslot

Enables/disables the control.

◆ setFocus

virtual void MLABWidgetControl::setFocus ( )
inlinevirtualslot

Sets the keyboard focus.

◆ setMaxHeight

void MLABWidgetControl::setMaxHeight ( int  s)
inlineslot

Sets the maximum height of the widget.

◆ setMaxSize

void MLABWidgetControl::setMaxSize ( QSize  size)
inlineslot

Sets the maximum size of the widget.

References size().

◆ setMaxWidth

void MLABWidgetControl::setMaxWidth ( int  s)
inlineslot

Sets the maximum width of the widget.

◆ setMinHeight

virtual void MLABWidgetControl::setMinHeight ( int  s)
inlinevirtualslot

Sets the minimum height of the widget.

Reimplemented in MLABWindowControl.

◆ setMinSize

void MLABWidgetControl::setMinSize ( QSize  size)
inlineslot

Sets the minimum size of the widget.

References size().

◆ setMinWidth

virtual void MLABWidgetControl::setMinWidth ( int  s)
inlinevirtualslot

Sets the minimum width of the widget.

Reimplemented in MLABWindowControl.

◆ setStyleSheetFromFile

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

Sets the Qt style sheet value from a file.

◆ setStyleSheetFromString

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

Sets the Qt style sheet value.

◆ setTitle

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.

◆ setToolTip

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

Sets a tool tip text for the control.

◆ setVisible

virtual void MLABWidgetControl::setVisible ( bool  flag)
virtualslot

Makes the control visible/invisible.

◆ setWhatsThis

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

Sets a Whats This text for the control.

◆ size

QSize MLABWidgetControl::size ( )
inlineslot

Returns the size of the widget.

Referenced by setMaxSize(), and setMinSize().

◆ sizeHint

QSize MLABWidgetControl::sizeHint ( )
inlineslot

Returns the size hint of the widget.

◆ tree

MLABTree* MLABWidgetControl::tree ( )
inlineslot

Returns the MDL tree for this control.

◆ updateLayout

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.

◆ updateMaxSize

void MLABWidgetControl::updateMaxSize ( )
slot

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

◆ widget

QWidget* MLABWidgetControl::widget ( )
inlineslot

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

◆ width

int MLABWidgetControl::width ( )
inlineslot

Returns the width of the widget.

◆ windowHandle

virtual QString MLABWidgetControl::windowHandle ( )
virtualslot

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

◆ windowID

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.