MeVisLab Scripting Reference
MLABRecentFilesHandler Class Reference

#include <mlabScriptWrappers.h>

Inherits QObject, and QObject.

Public Slots

void setup (MLABPopupMenuControl *menuToAddTo)
 
void setupWithExistingMenu (MLABPopupMenuControl *recentFilesMenu)
 
QStringList recentFiles () const
 
void setRecentFiles (const QStringList &files)
 
QString recentFilePath ()
 
void addRecentFile (const QString &file)
 
void removeRecentFile (const QString &file)
 

Signals

void fileActivated (const QString &file)
 

Detailed Description

MLABRecentFilesHandler.

An MLABRecentFilesHandler manages a recent files sub menu.

Here is an example on how to use it:

def init():
recentFiles = MLAB.readKey(applicationName, recentFilesKey)
recentFilesHandler = MLAB.createRecentFilesHandler(ctx.window())
recentFilesHandler.setup(ctx.control("someMenu"))
recentFilesHandler.setRecentFiles(recentFiles.split(","))
recentFilesHandler.connect("fileActivated(QString)", loadFile)
def loadFile(filename):
# ...
recentFilesHandler.addRecentFile(filename)
recentFiles = recentFilesHandler.recentFiles()
recentFiles = ",".join(recentFiles)
MLAB.writeKey(applicationName, recentFilesKey, recentFiles)
MLAB.writeRegistry()
Access to all global functions and objects of MLAB.
Definition mlabGlobalScriptAccess.h:79

Member Function Documentation

◆ addRecentFile

void MLABRecentFilesHandler::addRecentFile ( const QString & file)
slot

Adds a recent file to the list.

◆ fileActivated

void MLABRecentFilesHandler::fileActivated ( const QString & file)
signal

This signal is emitted when a recent file was activated.

◆ recentFilePath

QString MLABRecentFilesHandler::recentFilePath ( )
slot

Returns the recent file path.

◆ recentFiles

QStringList MLABRecentFilesHandler::recentFiles ( ) const
slot

Returns the list of recent files.

◆ removeRecentFile

void MLABRecentFilesHandler::removeRecentFile ( const QString & file)
slot

Removes a recent file from the list.

◆ setRecentFiles

void MLABRecentFilesHandler::setRecentFiles ( const QStringList & files)
slot

Returns the list of recent files.

◆ setup

void MLABRecentFilesHandler::setup ( MLABPopupMenuControl * menuToAddTo)
slot

Appends a menu item to menuToAddTo.

◆ setupWithExistingMenu

void MLABRecentFilesHandler::setupWithExistingMenu ( MLABPopupMenuControl * recentFilesMenu)
slot

Use the existing files menu.