Gui::BitmapFactoryInst Class Reference

#include <BitmapFactory.h>

Public Types

enum  Position { TopLeft , TopRight , BottomLeft , BottomRight }
 

Public Member Functions

void addPath (const QString &path)
 Adds a path where pixmaps can be found. More...
 
void addPixmapToCache (const char *name, const QPixmap &icon)
 Adds a build in XPM pixmap under a given name. More...
 
void addXPM (const char *name, const char **pXPM)
 Adds a build in XPM pixmap under a given name. More...
 
void convert (const QImage &img, SoSFImage &out) const
 Converts a QImage into a SoSFImage to use it inside a SoImage node. More...
 
void convert (const SoSFImage &img, QImage &out) const
 Converts a SoSFImage into a QImage. More...
 
QPixmap disabled (const QPixmap &p) const
 Creates a disabled pixmap of the given pixmap p by changing the brightness of all opaque pixels to a higher value. More...
 
QPixmap fillRect (int x, int y, int w, int h, const QPixmap &p, Qt::BGMode) const
 Creates an opaque or transparent area in a pixmap If the background mode is opaque then this method can be used for drawing a smaller pixmap into pixmap p. More...
 
QStringList findIconFiles () const
 Returns the absolute file names of icons found in the given search paths. More...
 
bool findPixmapInCache (const char *name, QPixmap &icon) const
 Checks whether the pixmap is already registered. More...
 
QStringList getPaths () const
 Returns the list of search paths. More...
 
QIcon iconFromTheme (const char *name, const QIcon &fallback=QIcon())
 Returns the QIcon corresponding to name in the current icon theme. More...
 
QPixmap merge (const QPixmap &p1, const QPixmap &p2, bool vertical) const
 Merges the two pixmaps p1 and p2 to one pixmap in vertical order if vertical is true, in horizontal order otherwise. More...
 
QPixmap merge (const QPixmap &p1, const QPixmap &p2, Position pos=BitmapFactoryInst::BottomLeft) const
 Merges the two pixmaps p1 and p2 to one pixmap. More...
 
QPixmap pixmap (const char *name) const
 Retrieves a pixmap by name. More...
 
QPixmap pixmapFromSvg (const char *name, const QSizeF &size, const std::map< unsigned long, unsigned long > &colorMapping=std::map< unsigned long, unsigned long >()) const
 Retrieves a pixmap by name and size created by an scalable vector graphics (SVG). More...
 
QPixmap pixmapFromSvg (const QByteArray &contents, const QSizeF &size, const std::map< unsigned long, unsigned long > &colorMapping=std::map< unsigned long, unsigned long >()) const
 This method is provided for convenience and does the same as the method above except that it creates the pixmap from a byte array. More...
 
QStringList pixmapNames () const
 Returns the names of all registered pixmaps. More...
 
void removePath (const QString &path)
 Removes a path from the list of pixmap paths. More...
 
QPixmap resize (int w, int h, const QPixmap &p, Qt::BGMode bgmode) const
 Resizes the area of a pixmap If the new size is greater than the old one the pixmap will be placed in the center. More...
 
- Public Member Functions inherited from Base::Factory
void AddProducer (const char *sClassName, AbstractProducer *pcProducer)
 Adds a new prducer instance. More...
 
std::list< std::string > CanProduce () const
 returns a list of all registered producer More...
 
bool CanProduce (const char *sClassName) const
 returns true if there is a producer for this class registered More...
 

Static Public Member Functions

static void destruct (void)
 
static BitmapFactoryInstinstance (void)
 
static QIcon mergePixmap (const QIcon &base, const QPixmap &px, Gui::BitmapFactoryInst::Position position)
 Helper method to merge a pixmap into one corner of a QIcon. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Base::Factory
 Factory ()
 construction More...
 
void * Produce (const char *sClassName) const
 produce a class with the given name More...
 
virtual ~Factory ()
 destruction More...
 

Member Enumeration Documentation

◆ Position

Enumerator
TopLeft 

Place to the top left corner.

TopRight 

Place to the top right corner.

BottomLeft 

Place to the bottom left corner.

BottomRight 

Place to the bottom right corner.

Member Function Documentation

◆ addPath()

void BitmapFactoryInst::addPath ( const QString &  path)

Adds a path where pixmaps can be found.

Referenced by Gui::Application::sAddIconPath(), and Gui::Application::sAddResPath().

◆ addPixmapToCache()

void BitmapFactoryInst::addPixmapToCache ( const char *  name,
const QPixmap &  icon 
)

Adds a build in XPM pixmap under a given name.

References Gui::BitmapFactoryInstP::xpmCache.

Referenced by Gui::Application::sAddIcon(), and Gui::Application::workbenchIcon().

◆ addXPM()

void BitmapFactoryInst::addXPM ( const char *  name,
const char **  pXPM 
)

Adds a build in XPM pixmap under a given name.

References Gui::BitmapFactoryInstP::xpmMap.

◆ convert() [1/2]

void BitmapFactoryInst::convert ( const QImage &  img,
SoSFImage &  out 
) const

◆ convert() [2/2]

void BitmapFactoryInst::convert ( const SoSFImage &  img,
QImage &  out 
) const

Converts a SoSFImage into a QImage.

◆ destruct()

void BitmapFactoryInst::destruct ( void  )
static

◆ disabled()

QPixmap BitmapFactoryInst::disabled ( const QPixmap &  p) const

Creates a disabled pixmap of the given pixmap p by changing the brightness of all opaque pixels to a higher value.

◆ fillRect()

QPixmap BitmapFactoryInst::fillRect ( int  x,
int  y,
int  w,
int  h,
const QPixmap &  p,
Qt::BGMode  bgmode 
) const

Creates an opaque or transparent area in a pixmap If the background mode is opaque then this method can be used for drawing a smaller pixmap into pixmap p.

Note: To draw a smaller pixmap into another one the area in the resulting pixmap for the small pixmapmust be opaque in every pixel, otherwise the drawing may fail.

If the background mode is transparent then this method can be used for resizing the pixmap p and make the new space transparent.

Referenced by merge(), and resize().

◆ findIconFiles()

QStringList BitmapFactoryInst::findIconFiles ( ) const

Returns the absolute file names of icons found in the given search paths.

Referenced by Gui::Dialog::IconDialog::IconDialog().

◆ findPixmapInCache()

bool BitmapFactoryInst::findPixmapInCache ( const char *  name,
QPixmap &  icon 
) const

Checks whether the pixmap is already registered.

References Gui::BitmapFactoryInstP::xpmCache.

◆ getPaths()

QStringList BitmapFactoryInst::getPaths ( ) const

Returns the list of search paths.

◆ iconFromTheme()

QIcon BitmapFactoryInst::iconFromTheme ( const char *  name,
const QIcon &  fallback = QIcon() 
)

Returns the QIcon corresponding to name in the current icon theme.

If no such icon is found in the current theme fallback is returned instead.

References pixmap().

Referenced by PartGui::ViewProviderBoolean::getIcon(), PartGui::ViewProviderMultiFuse::getIcon(), PartGui::ViewProviderMultiCommon::getIcon(), and Gui::PythonGroupCommand::languageChange().

◆ instance()

◆ merge() [1/2]

QPixmap BitmapFactoryInst::merge ( const QPixmap &  p1,
const QPixmap &  p2,
bool  vertical 
) const

Merges the two pixmaps p1 and p2 to one pixmap in vertical order if vertical is true, in horizontal order otherwise.

The method resizes the resulting pixmap.

Referenced by mergePixmap(), Gui::Thumbnail::SaveDocFile(), Gui::CallTipsList::showTips(), and Gui::DocumentObjectItem::testStatus().

◆ merge() [2/2]

QPixmap BitmapFactoryInst::merge ( const QPixmap &  p1,
const QPixmap &  p2,
Position  pos = BitmapFactoryInst::BottomLeft 
) const

Merges the two pixmaps p1 and p2 to one pixmap.

The position of the smaller pixmap p2 is drawn into the given position pos of the bigger pixmap p1. This method does not resize the resulting pixmap.

References BottomLeft, BottomRight, fillRect(), TopLeft, and TopRight.

◆ mergePixmap()

QIcon BitmapFactoryInst::mergePixmap ( const QIcon &  base,
const QPixmap &  px,
Gui::BitmapFactoryInst::Position  position 
)
static

◆ pixmap()

◆ pixmapFromSvg() [1/2]

QPixmap BitmapFactoryInst::pixmapFromSvg ( const char *  name,
const QSizeF &  size,
const std::map< unsigned long, unsigned long > &  colorMapping = std::map<unsigned long, unsigned long>() 
) const

Retrieves a pixmap by name and size created by an scalable vector graphics (SVG).

Parameters
colorMapping- a dictionary of substitute colors. Can be used to customize icon color scheme, e.g. crosshair color

References pixmapFromSvg().

Referenced by Gui::ExpressionBinding::getIcon(), ExpressionDelegate::getIcon(), Gui::ViewProviderLink::getOverlayPixmap(), pixmapFromSvg(), TechDrawGui::QGVPage::prepareCursorPixmap(), and SketcherGui::DrawSketchHandler::suggestedConstraintsPixmaps().

◆ pixmapFromSvg() [2/2]

QPixmap BitmapFactoryInst::pixmapFromSvg ( const QByteArray &  contents,
const QSizeF &  size,
const std::map< unsigned long, unsigned long > &  colorMapping = std::map<unsigned long, unsigned long>() 
) const

This method is provided for convenience and does the same as the method above except that it creates the pixmap from a byte array.

Parameters
colorMapping- see above.

References Base::ConsoleSingleton::MsgType_Wrn.

◆ pixmapNames()

QStringList BitmapFactoryInst::pixmapNames ( ) const

Returns the names of all registered pixmaps.

To get the appropriate pixmaps call pixmap() for each name.

References Gui::BitmapFactoryInstP::xpmCache, and Gui::BitmapFactoryInstP::xpmMap.

◆ removePath()

void BitmapFactoryInst::removePath ( const QString &  path)

Removes a path from the list of pixmap paths.

◆ resize()

QPixmap BitmapFactoryInst::resize ( int  w,
int  h,
const QPixmap &  p,
Qt::BGMode  bgmode 
) const

Resizes the area of a pixmap If the new size is greater than the old one the pixmap will be placed in the center.

The border area will be made depending on bgmode transparent or opaque.

References fillRect().


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