MeVisLab Scripting Reference
MLABPopupMenuControl Class Reference

#include <mlabPopupMenuControl.h>

Inherits MLABWidgetControl.

Scripting access.

QMenu * _menu
 
MLABPopupMenuControlappendPopupItem (const QString &text, const QString &name)
 
MLABPopupMenuControlappendPopupItem (const QString &text)
 
MLABPopupMenuControlinsertPopupItem (int index, const QString &text, const QString &name)
 
MLABPopupMenuControlinsertPopupItem (int index, const QString &text)
 
MLABPopupMenuControlgetPopupItem (const QString &name)
 
QAction * appendItem (const QString &text, const QVariant &script, const QString &name)
 
QAction * appendItem (const QString &text, const QVariant &script)
 
QAction * appendFieldItem (MLABField *field, const QString &text=QString())
 
QAction * appendSeparator ()
 
QAction * insertSeparator (QAction *action)
 
QAction * appendSeparator (const QString &name)
 
QAction * insertSeparator (QAction *action, const QString &name)
 
QAction * insertSeparator (int index)
 
QAction * insertSeparator (int index, const QString &name)
 
QAction * insertItem (int index, const QString &text, const QVariant &script, const QString &name)
 
QAction * insertItem (int index, const QString &text, const QVariant &script)
 
QAction * insertFieldItem (int index, MLABField *field, const QString &text=QString())
 
bool hasItem (const QString &name)
 
bool isItemChecked (const QString &name)
 
void setItemChecked (const QString &name, bool flag)
 
bool isItemEnabled (const QString &name)
 
void setItemEnabled (const QString &name, bool flag)
 
bool isItemVisible (const QString &name)
 
void setItemVisible (const QString &name, bool flag)
 
void setItemText (const QString &name, const QString &text)
 
QString itemText (const QString &name)
 
void setItemIcon (const QString &name, const QString &pixmapfile)
 
void setItemPixmap (const QString &name, const QString &pixmapfile)
 
void setItemAccel (const QString &name, const QString &accel)
 
void setItemWhatsThis (const QString &name, const QString &whatsthis)
 
void setItemIconVisibleInMenu (const QString &name, bool visible=true)
 
void removeItem (const QString &name)
 
void clearItems ()
 
void popup ()
 
void popup (const QPoint &pos)
 
QMenu * menu ()
 
void itemActivated (const QString &name)
 
void aboutToShow ()
 
void aboutToHide ()
 
MLABScriptMenu * findNamedItem (const QString &name, QAction *&action, bool printErrorIfNotFound=true)
 

Additional Inherited Members

- Public Types inherited from MLABWidgetControl
enum  TitleType
 
- 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 ()
 
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
 
virtual QString py_toString ()
 
- Public Member Functions inherited from MLABWidgetControl
bool createScreenshot (QWidget *widget, const QString &filename, int x=0, int y=0, int w=-1, int h=-1, bool grabFromScreen=true, bool scaleToLowRes=false)
 
void setStyle (MLABStyle *proto)
 
MLABStyle * style ()
 
QString buildTitleString (MLABField *optionalField, bool splitUppercase, TitleType *resultTitleType=nullptr)
 
void evaluateVisibleOnExpression ()
 
- Static Public Member Functions inherited from MLABWidgetControl
static bool showMDLFileForWidget (QWidget *w)
 
static bool showHelpContextMenuForWidget (QWidget *w)
 
static QKeySequence getKeySequence (const MLABTree *attrib)
 
static QString trimString (const QString &s, QWidget *w, trim mode)
 
- Protected Slots inherited from MLABWidgetControl
void emitResizeCommand ()
 
void updateEnabledState ()
 
void setVisibleDelayed (bool visible)
 
void tooltipFieldChanged ()
 
- Protected Member Functions inherited from MLABWidgetControl
void setupEditedField ()
 
virtual void internalReload ()
 
virtual void addDefaultTagValues (MLABTree *tree) const
 
void addDefaultTagValue (MLABTree *tree, const QString &tagName, const QString &tagValue) const
 
void addDefaultTagValue (MLABTree *tree, const QString &tagName, const char *tagValue) const
 
void addDefaultTagValue (MLABTree *tree, const QString &tagName, bool tagValue) const
 
void addDefaultTagValue (MLABTree *tree, const QString &tagName, int tagValue) const
 
void addDefaultTagValue (MLABTree *tree, const QString &tagName, unsigned int tagValue) const
 
void addDefaultTagValue (MLABTree *tree, const QString &tagName, float tagValue) const
 
void addDefaultTagValue (MLABTree *tree, const QString &tagName, double tagValue) const
 
bool verifyThatParentsHaveDifferentAlignGroups (const QString &alignGroup, bool isXAlign)
 
MLABFieldlookupField (const QString fieldname, MLABTree *tree, const char *classname=nullptr, bool warn=true)
 
QPixmap readPixmap (MLABTree *tree)
 
QPixmap readPixmap (const QString &filename)
 
QPixmap readPixmap (MLABTree *tree, float scale)
 
QPixmap readPixmap (const QString &filename, float scale)
 
QImage readImage (MLABTree *tree, float scale)
 
QImage readImage (const QString &filename, float scale)
 
void updateMaxSize (bool maygrow)
 
QString trimString (const QString &s, QWidget *w)
 
void setupScaleFactor ()
 
QString uniqueGroupString ()
 
bool createIconSet (QIcon &icon, QAbstractButton *button=nullptr, bool autoScale=false)
 
bool createIconSetPixmap (QIcon &iconset, const QString &name, QIcon::Mode mode, QIcon::State state, bool resize=false, QSize *scaleSize=nullptr)
 
bool createIconSet (MLABTree *tree, QIcon &icon, QAbstractButton *button=nullptr, bool autoScale=false)
 
bool createIconSetPixmap (MLABTree *tree, QIcon &iconset, const QString &name, QIcon::Mode mode, QIcon::State state, bool resize=false, QSize *scaleSize=nullptr)
 
QSize defaultIconSize ()
 
virtual void applyStyle ()
 
QString loadStyleSheetFile (const QString &styleSheetFileName)
 
- Static Protected Member Functions inherited from MLABWidgetControl
static QString loadTextFileWithReplacedMDLVariables (const QString &filename)
 
static bool shouldExpandCheck (MLABTree *t)
 
static QString removeStyleSheetComments (const QString &style)
 
- Protected Attributes inherited from MLABWidgetControl
struct MLABWidgetControl::__flags _flags
 
MLABTreePtr _tree
 
MLABTreePtr _prototype
 
MLABStylePtr _style
 
QWidget * _widget
 
int _windowId
 
float _scale
 
MLABWidgetControlContextInfo * _info
 
int _controlType
 
QString _alignGroupX
 
QString _alignGroupY
 
QString _alignGroupLabels
 
QString _alignChildX
 
QString _alignChildY
 
int _maxColIndex
 
int _maxRowIndex
 
int _layoutXDepth
 
int _layoutYDepth
 
QPointer< MLABModule_module
 
QPointer< MLABField_field
 
QPointer< MLABField_tooltipField
 
MLABFieldExpressionEvaluator * _visibleOnEvaluator
 
trim _trim
 
bool _isReloadable
 
- Static Protected Attributes inherited from MLABWidgetControl
static MLABTreePtr _currentAttrib
 
static int _uniqAlignGroupCounter
 
static const bool expandXDefault = false
 
static const bool expandYDefault = false
 
static const QString alignXDefault
 
static const QString alignYDefault
 
static const QString bgModeDefault
 
static const QString editBgModeDefault
 
static const QString buttonBgModeDefault
 
static const int colspanDefault = 1
 

Detailed Description

PopupMenu control.

PopupMenu control to access popup menus from scripting.

Member Function Documentation

◆ appendFieldItem

QAction * MLABPopupMenuControl::appendFieldItem ( MLABField field,
const QString &  text = QString() 
)
slot

Appends a field item.

The field is touched if the item is triggered. Bool fields are toggled when the item is triggered.

◆ appendItem [1/2]

QAction * MLABPopupMenuControl::appendItem ( const QString &  text,
const QVariant &  script 
)
slot

Appends an item (unnamed).

◆ appendItem [2/2]

QAction * MLABPopupMenuControl::appendItem ( const QString &  text,
const QVariant &  script,
const QString &  name 
)
slot

Appends an item (with given name).

◆ appendPopupItem [1/2]

MLABPopupMenuControl * MLABPopupMenuControl::appendPopupItem ( const QString &  text)
slot

Appends a popup menu item (unnamed).

◆ appendPopupItem [2/2]

MLABPopupMenuControl * MLABPopupMenuControl::appendPopupItem ( const QString &  text,
const QString &  name 
)
slot

Appends a popup menu item (with given name, the new popup is both registered as a control and as a menu item).

Note
If you want to remove it again, call .widget().delete() on the returned control.

◆ appendSeparator [1/2]

QAction * MLABPopupMenuControl::appendSeparator ( )
slot

Appends a separator item.

◆ appendSeparator [2/2]

QAction * MLABPopupMenuControl::appendSeparator ( const QString &  name)
slot

Appends a separator item.

◆ clearItems

void MLABPopupMenuControl::clearItems ( )
slot

Removes all items.

◆ getPopupItem

MLABPopupMenuControl * MLABPopupMenuControl::getPopupItem ( const QString &  name)
slot

Returns the item popup with the given name, or NULL if it does not exists.

◆ hasItem

bool MLABPopupMenuControl::hasItem ( const QString &  name)
slot

Returns whether an item with the given name exists.

◆ insertFieldItem

QAction * MLABPopupMenuControl::insertFieldItem ( int  index,
MLABField field,
const QString &  text = QString() 
)
slot

Appends a field item.

The field is touched if the item is triggered. Bool fields are toggled when the item is triggered.

◆ insertItem [1/2]

QAction * MLABPopupMenuControl::insertItem ( int  index,
const QString &  text,
const QVariant &  script 
)
slot

Inserts an item (unnamed) at index (0= top, -1= bottom).

◆ insertItem [2/2]

QAction * MLABPopupMenuControl::insertItem ( int  index,
const QString &  text,
const QVariant &  script,
const QString &  name 
)
slot

Inserts an item (with given name) at index (0= top, -1= bottom).

◆ insertPopupItem [1/2]

MLABPopupMenuControl * MLABPopupMenuControl::insertPopupItem ( int  index,
const QString &  text 
)
slot

Inserts a popup menu item (unnamed).

◆ insertPopupItem [2/2]

MLABPopupMenuControl * MLABPopupMenuControl::insertPopupItem ( int  index,
const QString &  text,
const QString &  name 
)
slot

Inserts a popup menu item (with given name , the new popup is both registered as a control and as a menu item).

◆ insertSeparator [1/4]

QAction * MLABPopupMenuControl::insertSeparator ( int  index)
slot

Inserts a separator item (deprecated, use one of the other overloads).

◆ insertSeparator [2/4]

QAction * MLABPopupMenuControl::insertSeparator ( int  index,
const QString &  name 
)
slot

Inserts a separator item (deprecated, use one of the other overloads).

◆ insertSeparator [3/4]

QAction * MLABPopupMenuControl::insertSeparator ( QAction *  action)
slot

Inserts a separator item.

◆ insertSeparator [4/4]

QAction * MLABPopupMenuControl::insertSeparator ( QAction *  action,
const QString &  name 
)
slot

Inserts a separator item.

◆ isItemChecked

bool MLABPopupMenuControl::isItemChecked ( const QString &  name)
slot

Returns whether an item is checked.

◆ isItemEnabled

bool MLABPopupMenuControl::isItemEnabled ( const QString &  name)
slot

Returns whether an item is enabled.

◆ isItemVisible

bool MLABPopupMenuControl::isItemVisible ( const QString &  name)
slot

Returns whether an item is visible.

◆ itemText

QString MLABPopupMenuControl::itemText ( const QString &  name)
slot

Returns an item's text.

◆ menu

QMenu * MLABPopupMenuControl::menu ( )
inlineslot

Returns access to the underlying QMenu.

◆ popup [1/2]

void MLABPopupMenuControl::popup ( )
slot

Pops up the menu at the current cursor pos.

◆ popup [2/2]

void MLABPopupMenuControl::popup ( const QPoint &  pos)
slot

Pops up the menu at the given screen position.

◆ removeItem

void MLABPopupMenuControl::removeItem ( const QString &  name)
slot

Removes an item.

◆ setItemAccel

void MLABPopupMenuControl::setItemAccel ( const QString &  name,
const QString &  accel 
)
slot

Sets a keyboard accelerator for the item.

◆ setItemChecked

void MLABPopupMenuControl::setItemChecked ( const QString &  name,
bool  flag 
)
slot

Sets whether an item is checked.

◆ setItemEnabled

void MLABPopupMenuControl::setItemEnabled ( const QString &  name,
bool  flag 
)
slot

Sets whether an item is enabled.

◆ setItemIcon

void MLABPopupMenuControl::setItemIcon ( const QString &  name,
const QString &  pixmapfile 
)
slot

Sets an icon that is shown to the left of the text.

◆ setItemIconVisibleInMenu

void MLABPopupMenuControl::setItemIconVisibleInMenu ( const QString &  name,
bool  visible = true 
)
slot

On some platforms icons are generally not shown in menus (such as OS X).

This function may be used to override this setting (Qt::AA_DontShowIconsInMenus attribute). If true, the icon is shown in the menu, when it is false, it is not shown.

◆ setItemPixmap

void MLABPopupMenuControl::setItemPixmap ( const QString &  name,
const QString &  pixmapfile 
)
slot

Sets a pixmap for the item (overwrites the text that may be set).

◆ setItemText

void MLABPopupMenuControl::setItemText ( const QString &  name,
const QString &  text 
)
slot

Sets the text of an item.

◆ setItemVisible

void MLABPopupMenuControl::setItemVisible ( const QString &  name,
bool  flag 
)
slot

Sets whether an item is visible.

◆ setItemWhatsThis

void MLABPopupMenuControl::setItemWhatsThis ( const QString &  name,
const QString &  whatsthis 
)
slot

Sets a keyboard accelerator for of the item.