Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MantidQt::API::WindowIcons Class Reference

Defines a mapping between a workspace ID and a pixmap to use for an icon. More...

#include <WindowIcons.h>

Public Member Functions

QIcon getIcon (const std::string &windowID) const
 Returns an icon for the given ID. More...
 
std::string getIconID (const std::string &windowID) const
 Returns an icon ID for the given window ID. More...
 
 WindowIcons ()
 Default constructor. More...
 

Private Member Functions

void initInternalLookup ()
 Defines the mapping between ID & pixmap name. More...
 
QIcon makeIconFromFile (const std::string &path) const
 Build a icon object from an image file. More...
 

Private Attributes

QMap< std::string, std::string > m_idToPixmapName
 Internal map instance. More...
 

Detailed Description

Defines a mapping between a workspace ID and a pixmap to use for an icon.

Definition at line 19 of file WindowIcons.h.

Constructor & Destructor Documentation

◆ WindowIcons()

MantidQt::API::WindowIcons::WindowIcons ( )

Default constructor.

Definition at line 22 of file WindowIcons.cpp.

References initInternalLookup().

Member Function Documentation

◆ getIcon()

QIcon MantidQt::API::WindowIcons::getIcon ( const std::string &  windowID) const

Returns an icon for the given ID.

Parameters
windowIDA string giving the ID for a window
Exceptions
std::runtime_errorif no icon can be found

Definition at line 28 of file WindowIcons.cpp.

References MantidQt::API::getQPixmap(), m_idToPixmapName, makeIconFromFile(), and value.

◆ getIconID()

std::string MantidQt::API::WindowIcons::getIconID ( const std::string &  windowID) const

Returns an icon ID for the given window ID.

Get the string ID representing the icon.

Parameters
windowID:: a string representing the ID of the window
Returns
a string with the QPixmap id for this window.

Definition at line 42 of file WindowIcons.cpp.

References m_idToPixmapName.

Referenced by MantidQt::MantidWidgets::ProjectSaveModel::makeWindowInfoObject().

◆ initInternalLookup()

void MantidQt::API::WindowIcons::initInternalLookup ( )
private

Defines the mapping between ID & pixmap name.

Initilise the internal lookup map.

Definition at line 56 of file WindowIcons.cpp.

References m_idToPixmapName.

Referenced by WindowIcons().

◆ makeIconFromFile()

QIcon MantidQt::API::WindowIcons::makeIconFromFile ( const std::string &  path) const
private

Build a icon object from an image file.

Make a QIcon object froma file path.

This is used in the case that a pixmap does not exist and a file path to an image was provided instead.

Parameters
path:: path to the image to use to create the icon
Returns
icon object made from the path

Definition at line 78 of file WindowIcons.cpp.

Referenced by getIcon().

Member Data Documentation

◆ m_idToPixmapName

QMap<std::string, std::string> MantidQt::API::WindowIcons::m_idToPixmapName
private

Internal map instance.

Definition at line 35 of file WindowIcons.h.

Referenced by getIcon(), getIconID(), and initInternalLookup().


The documentation for this class was generated from the following files: