Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::Resource Class Reference

Class for accessing resources like SVG images as a QIcon. More...

#include <Resource.h>

Public Types

enum  Icon : int {
  Clear , Reload , Submit , New ,
  Open , Cut , Copy , Paste ,
  Undo , Redo , Save , Cancel ,
  Close , Check , Okay , Exit ,
  CloseWindow , CloseWindows , Configuration , Settings ,
  Application , Development , Compile , Initialize ,
  Step , Run , Start , Stop ,
  Edit , Add , Remove , Folder ,
  Collapse , Expand , OpenFolder , Hand ,
  Search , Form , Container , Widget ,
  Palette , Position , Location , Tools ,
  Graph
}
 List of available icons which is easy wen using auto complete. More...
 

Static Public Member Functions

static QString getSvgIconResource (Icon icon)
 Gets an svg icon resource location from the pass enumerate value.
 
static QByteArray getByteArray (const QString &resource)
 Retrieves resource in a byte array.
 
static QByteArray getSvg (QFile &file, const QColor &color=QColor(), const QSize &size=QSize())
 Gets a SVG using the passed color as the main color set in the 'svg' tags attribute.
 
static QImage getSvgImage (const QString &resource, const QColor &color=QColor(), const QSize &size=QSize())
 Gets a SVG using the passed color as the main color set in the 'svg' tags attribute.
 
static QIcon getSvgIcon (const QString &resource, const QColor &color=QColor(), QSize size=QSize())
 Gets an SVG QIcon type from a resource location using the passed color and optional size.
 
static QIcon getSvgIcon (const QString &resource, const QPalette &palette, QPalette::ColorRole role, QSize size=QSize())
 Gets an SVG QIcon type from a resource location using the palette and role for color.
 
static QIcon getSvgIcon (const QString &resource, QPalette::ColorRole role, QSize size=QSize())
 Gets an SVG QIcon type from a resource location using the application palette and the passed role for color.
 

Detailed Description

Class for accessing resources like SVG images as a QIcon.

Member Enumeration Documentation

◆ Icon

enum sf::Resource::Icon : int

List of available icons which is easy wen using auto complete.

Enumerator
Clear 
Reload 
Submit 
New 
Open 
Cut 
Copy 
Paste 
Undo 
Redo 
Save 
Cancel 
Close 
Check 
Okay 
Exit 
CloseWindow 
CloseWindows 
Configuration 
Settings 
Application 
Development 
Compile 
Initialize 
Step 
Run 
Start 
Stop 
Edit 
Add 
Remove 
Folder 
Collapse 
Expand 
OpenFolder 
Hand 
Search 
Form 
Container 
Widget 
Palette 
Position 
Location 
Tools 
Graph 

Member Function Documentation

◆ getByteArray()

static QByteArray sf::Resource::getByteArray ( const QString &  resource)
static

Retrieves resource in a byte array.

Parameters
resourcelocation in the resource tree or file.
Returns
Resource file content.

◆ getSvg()

static QByteArray sf::Resource::getSvg ( QFile &  file,
const QColor &  color = QColor(),
const QSize &  size = QSize() 
)
static

Gets a SVG using the passed color as the main color set in the 'svg' tags attribute.

Parameters
fileFile instance.
colorHTML formed color string. Default is non valid color.
sizeSize of the square icon where when -1 the svg size is not set and thus not restricted (default).
Returns
The SVG data on success and zero length on failure.

◆ getSvgIcon() [1/3]

static QIcon sf::Resource::getSvgIcon ( const QString &  resource,
const QColor &  color = QColor(),
QSize  size = QSize() 
)
static

Gets an SVG QIcon type from a resource location using the passed color and optional size.

Parameters
resourceLocation of the icon.
colorColor for the icon.
sizeSize of the icon where when not passed default set to _defaultIconSize (128x128).
Returns
On success the colored icon otherwise the warning icon.

◆ getSvgIcon() [2/3]

static QIcon sf::Resource::getSvgIcon ( const QString &  resource,
const QPalette &  palette,
QPalette::ColorRole  role,
QSize  size = QSize() 
)
static

Gets an SVG QIcon type from a resource location using the palette and role for color.

Parameters
resourceLocation of the Icon.
paletteThe pallet to determine the color for the Icon.
roleThe color role to determine the color for the Icon.
sizeSize of the icon where when not passed default set to _defaultIconSize (128x128).
Returns
On success the colored icon.

◆ getSvgIcon() [3/3]

static QIcon sf::Resource::getSvgIcon ( const QString &  resource,
QPalette::ColorRole  role,
QSize  size = QSize() 
)
static

Gets an SVG QIcon type from a resource location using the application palette and the passed role for color.

Parameters
resourceLocation of the Icon.
roleThe color role to determine the color for the Icon.
sizeSize of the icon where when not passed default set to _defaultIconSize (128x128).
Returns
On success the colored icon.

◆ getSvgIconResource()

static QString sf::Resource::getSvgIconResource ( Icon  icon)
static

Gets an svg icon resource location from the pass enumerate value.

Parameters
iconEnumerate color value.
Returns
Resource location

◆ getSvgImage()

static QImage sf::Resource::getSvgImage ( const QString &  resource,
const QColor &  color = QColor(),
const QSize &  size = QSize() 
)
static

Gets a SVG using the passed color as the main color set in the 'svg' tags attribute.

When the color's alpha channel has been set to total image is made transparent since Qt does not support rgba(...) colors when rendering.

Parameters
resourceLocation of the image.
colorHTML formed color string. Default is non valid color.
sizeSize of the square icon where when -1 the svg size is not set and thus not restricted (default).
Returns
SVG image on success or the default warning PNG image.

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