Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Qtx Class Reference

A set of helpful utility functions. More...

#include <Qtx.h>

Inheritance diagram for Qtx:
Inheritance graph

Classes

class  BackgroundData
 Stores background data. More...
 
class  CmdLineArgs
 Get access to the command line arguments in the C-like manner. More...
 
class  Localizer
 Localization helper. More...
 

Public Types

enum  AlignmentFlags {
  AlignLeft = Qt::AlignLeft, AlignLeading = Qt::AlignLeading, AlignRight = Qt::AlignRight, AlignTrailing = Qt::AlignTrailing,
  AlignHCenter = Qt::AlignHCenter, AlignJustify = Qt::AlignJustify, AlignAbsolute = Qt::AlignAbsolute, AlignHorizontal_Mask = Qt::AlignHorizontal_Mask,
  AlignTop = Qt::AlignTop, AlignBottom = Qt::AlignBottom, AlignVCenter = Qt::AlignVCenter, AlignVertical_Mask = Qt::AlignVertical_Mask,
  AlignCenter = Qt::AlignCenter, AlignOutLeft = Qt::AlignVCenter << 2, AlignOutRight = AlignOutLeft << 2, AlignOutTop = AlignOutRight << 2,
  AlignOutBottom = AlignOutTop << 2
}
 Widget alignment flags. More...
 
enum  PathType { PT_OpenFile, PT_SaveFile, PT_Directory }
 Path type, indicates required directory/file operation. More...
 
enum  { AppropriateRole = Qt::UserRole + 100 }
 Custom data roles. More...
 
enum  Appropriate { Shown, Hidden, Toggled }
 
enum  SubstMode { Always, Never, Auto }
 Environment variables substitution mode. More...
 
enum  VisibilityState { ShownState, HiddenState, UnpresentableState }
 object visibility state More...
 
enum  HeaderViewFlags { ShowText = 0x001, ShowIcon = 0x010, ShowAll = ShowText | ShowIcon }
 Header view flags. More...
 
enum  CustomDataType { IdType }
 Type of the custom data (for custom tree model) More...
 
enum  BackgroundMode { NoBackground, ColorBackground, SimpleGradientBackground, CustomGradientBackground }
 Background mode. More...
 
enum  TextureMode { CenterTexture, TileTexture, StretchTexture }
 Texture mode. More...
 

Static Public Member Functions

static QString toQString (const char *, const int=-1)
 Convert character array (ASCII string) to the QString. More...
 
static QString toQString (const short *, const int=-1)
 Convert integer array (UNICODE string) to the QString. More...
 
static QString toQString (const unsigned char *, const int=-1)
 Convert character array (ASCII string) to the QString. More...
 
static QString toQString (const unsigned short *, const int=-1)
 Convert integer array (UNICODE string) to the QString. More...
 
static void setTabOrder (QWidget *,...)
 Set tab order for specified list of widgets. More...
 
static void setTabOrder (const QWidgetList &)
 Set tab order for specified list of widgets. More...
 
static void alignWidget (QWidget *, const QWidget *, const int)
 Align widget src relative to widget ref acording to the alignment flags alignFlags. More...
 
static void simplifySeparators (QWidget *, const bool=true)
 Remove (recursively) unnecessary separators from the menu or toolbar. More...
 
static bool isParent (QObject *, QObject *)
 Return true if specified parent is a parent object of given child (in terms of QObject). More...
 
static QObjectfindParent (QObject *, const char *)
 Find the parent object of class specified by className (in terms of QObject). More...
 
static QString dir (const QString &, const bool=true)
 Return directory part of the file path. More...
 
static QString file (const QString &, const bool=true)
 Return file name part of the file path. More...
 
static QString extension (const QString &, const bool=false)
 Return extension part of the file path. More...
 
static QString library (const QString &)
 Convert the given parameter to the platform-specific library name. More...
 
static QString tmpDir ()
 Get the temporary directory name. More...
 
static bool mkDir (const QString &)
 Create directory recursively including all intermediate sub directories. More...
 
static bool rmDir (const QString &)
 Remove directory recursively including all subdirectories and files. More...
 
static bool dos2unix (const QString &)
 Convert text file from DOS format to UNIX. More...
 
static QString addSlash (const QString &)
 Add a slash (platform-specific) to the end of path if it is not already there. More...
 
static QCompleter * pathCompleter (const PathType, const QString &=QString())
 Create path completer which can be used in the widgets to provide auto completions. More...
 
static QString findEnvVar (const QString &, int &, int &)
 Parse given string to retrieve environment variable. More...
 
static QString makeEnvVarSubst (const QString &, const SubstMode=Auto)
 Substitute environment variables by their values. More...
 
static int rgbSet (const QColor &)
 Pack the specified color into integer RGB set. More...
 
static int rgbSet (const int, const int, const int)
 Pack the specified RGB color components into integer RGB set. More...
 
static QColor rgbSet (const int)
 Unpack the specified integer RGB set to the color. More...
 
static void rgbSet (const int, int &, int &, int &)
 Unpack the specified integer RGB set to the three RGB components. More...
 
static QColor scaleColor (const int, const int, const int)
 Return the color specified by the index between min (blue) and max (red). More...
 
static void scaleColors (const int, QColorList &)
 Generate required number of colors aligned from blue to red. More...
 
static QPixmap scaleIcon (const QPixmap &, const unsigned, const unsigned=0)
 Scale the pixmap to the required size. More...
 
static QImage grayscale (const QImage &)
 Convert given image to the grayscale format. More...
 
static QPixmap grayscale (const QPixmap &)
 Convert given pixmap to the grayscale format. More...
 
static QImage transparentImage (const int, const int, const int=-1)
 Create transparent image. More...
 
static QPixmap transparentPixmap (const int, const int, const int=-1)
 Create transparent pixmap. More...
 
static QPixmap composite (const QPixmap &, const int, const int, const QPixmap &=QPixmap())
 Create composite pixmap. More...
 
static QString colorToString (const QColor &)
 Convert color to the string representation. More...
 
static bool stringToColor (const QString &, QColor &)
 Create color from the string representation. More...
 
static QString biColorToString (const QColor &, const int)
 Convert bi-color value to the string representation. More...
 
static bool stringToBiColor (const QString &, QColor &, int &)
 Restore bi-color value from the string representation. More...
 
static QColor mainColorToSecondary (const QColor &, int)
 Compute secondary color value from specified main color and delta. More...
 
static QString gradientToString (const QLinearGradient &)
 Dump linear gradient to the string description. More...
 
static QString gradientToString (const QRadialGradient &)
 Dump radial gradient to the string description. More...
 
static QString gradientToString (const QConicalGradient &)
 Dump conical gradient to the string description. More...
 
static bool stringToLinearGradient (const QString &, QLinearGradient &)
 Create linear gradient from its string representation. More...
 
static bool stringToRadialGradient (const QString &, QRadialGradient &)
 Create radial gradient from its string representation. More...
 
static bool stringToConicalGradient (const QString &, QConicalGradient &)
 Create conical gradient from its string representation. More...
 
static QString backgroundToString (const BackgroundData &)
 Convert background data to the string representation. The resulting string consists of several sub-strings separated by ';' symbol. These sub-strings represent: More...
 
static BackgroundData stringToBackground (const QString &)
 Restore background data from the string representation. More...
 
static long versionToId (const QString &)
 Convert string representation of version identifier to the numerical value. Resulting value can be used for comparison of different versions (lower, higher, equal). More...
 
static QString qtDir (const QString &=QString())
 Get Qt installation directory. More...
 
static QFont stringToFont (const QString &fontDescription)
 
static void * getDisplay ()
 Open the default X display and returns pointer to it. This method is available on Linux only. More...
 
static Qt::HANDLE getVisual ()
 Returns pointer to X visual suitable for 3D rendering. This method is available on Linux only. More...
 

Detailed Description

The class implements a set of the static functions which can be used for the different purposes:

Member Enumeration Documentation

anonymous enum
Enumerator
AppropriateRole 

can be used to return true if data is appropriate

Enumerator
AlignLeft 

align left side of one widget to the left side of another widget

AlignLeading 

synonim for AlignLeft

AlignRight 

align right side of one widget to the right side of another widget

AlignTrailing 

synonim for AlignRight

AlignHCenter 

align one widget to the center of another widget in horizontal dimension

AlignJustify 

synonym of Qt::AlignJustify

AlignAbsolute 

synonym of Qt::AlignAbsolute

AlignHorizontal_Mask 

synonym of Qt::AlignHorizontal_Mask

AlignTop 

align top side of one widget to the top side of another widget

AlignBottom 

align bottom side of one widget to the bottom side of another widget

AlignVCenter 

align one widget to the center of another widget in vertical dimension

AlignVertical_Mask 

synonym of Qt::AlignVertical_Mask

AlignCenter 

align one widget to the center of another widget in both dimensions

AlignOutLeft 

align right side of one widget to the left side of another widget

AlignOutRight 

align left side of one widget to the right side of another widget

AlignOutTop 

align bottom side of one widget to the top side of another widget

AlignOutBottom 

align top side of one widget to the bottom side of another widget

Enumerator
Shown 

column should be always visible

Hidden 

column should be always hidden

Toggled 

it should be possible to show/hide the column with help of popup menu

Enumerator
NoBackground 
ColorBackground 
SimpleGradientBackground 
CustomGradientBackground 
Enumerator
IdType 
Enumerator
ShowText 

Show only text in the header.

ShowIcon 

Show only icon in the header.

ShowAll 

Show icon and text in the header.

Enumerator
PT_OpenFile 

the file is opened

PT_SaveFile 

the file is saved

PT_Directory 

the directory path is required

Enumerator
Always 

substitute environment variable by it's value if variable exists, and "" otherwise

Never 

keep environment variable as is without any substitution

Auto 

substitute environment variable by it's value if variable exists, and keep it as is otherwise

Enumerator
CenterTexture 
TileTexture 
StretchTexture 
Enumerator
ShownState 

Object is shown in viewer.

HiddenState 

Object is hidden in viewer.

UnpresentableState 

Unpresentable object.

Member Function Documentation

QString Qtx::addSlash ( const QString &  path)
static
Parameters
pathdirectory path
Returns
modified path (with slash added to the end)
void Qtx::alignWidget ( QWidget src,
const QWidget ref,
const int  alignFlags 
)
static
Parameters
srcsource widget (being aligned)
refreference widget (source widget being aligned to)
alignFlagsalignment flags (Qtx::AlignmentFlags)

References AlignBottom, AlignHCenter, AlignLeft, AlignOutBottom, AlignOutLeft, AlignOutRight, AlignOutTop, AlignRight, AlignTop, and AlignVCenter.

QString Qtx::backgroundToString ( const BackgroundData bgData)
static
  1. background type (enumerator, see Qtx::BackgroundMode)
  2. texture image file name (string)
  3. texture mode (enumerator, see Qtx::TextureMode)
  4. "show texture" flag (boolean)
  5. first color (for simple gradient data) or solid color (for single-colored mode)
  6. second color (for simple gradient data)
  7. type of simple gradient (some integer identifier)
  8. complex gradient data (for custom gradient mode) Each sub-string consists of keyword/value couple, in form of "<keyword>=<value>".

Backward conversion can be done with stringToBackground() method.

Parameters
bgDatabackground data
Returns
string representation of the background data
See Also
stringToBackground()

References colorToString(), Qtx::BackgroundData::gradient(), gradientToString(), Qtx::BackgroundData::isTextureShown(), Qtx::BackgroundData::mode(), and Qtx::BackgroundData::texture().

QString Qtx::biColorToString ( const QColor &  color,
const int  delta 
)
static

Bi-color value is specified as main color and integer delta value that is used to calculate secondary color by changing paremeters of the main color ("saturation" and "value" components in HSV notation).

The resulting string consists of two sub-strings separated by '|' symbol. The first part represents main color (see colorToString() for more details), the second part is a delta value.

Backward conversion can be done with stringToBiColor() method.

Parameters
colorcolor to be converted
deltadelta value
Returns
string representation of the bi-color value
See Also
stringToBiColor(), stringToColor()

References colorToString().

QString Qtx::colorToString ( const QColor &  color)
static

The resulting string is in the one of two possible formats (RR, GG, BB and AA value represent red, green, blue and alpha components of the color):

  • if color has alpha channel : "#RR,#GG,#BB,#AA"
  • if color does not have alpha channel : "#RRGGBB"

If color is invalid, null string is returned.

Backward conversion can be done with stringToColor() method.

Parameters
colorcolor to be converted
Returns
string representation of the color
See Also
stringToColor()
QPixmap Qtx::composite ( const QPixmap &  pix,
const int  x,
const int  y,
const QPixmap &  dest = QPixmap() 
)
static

Pixmap pix is drawn over pixmap dest with coordinates specified relatively to the upper left corner of dest. If dest is not given, the new empty pixmap with appropriate size created instead.

Parameters
pixsource pixmap
xhorizontal shift
yvertical shift
destbackground pixmap
Returns
resulting pixmap

References transparentImage().

QString Qtx::dir ( const QString &  path,
const bool  abs = true 
)
static

If the file path does not include directory part (the file is in the current directory), null string is returned.

Parameters
pathfile path
absif true (default) path parameter is treated as absolute file path
Returns
directory part of the file path
bool Qtx::dos2unix ( const QString &  absName)
static

The function replaces "LF/CR" symbols sequence by "LF" symbol.

Parameters
absNamefile name
Returns
true if the file is converted successfully and false in case of any error

References dir().

QString Qtx::extension ( const QString &  path,
const bool  full = false 
)
static
Parameters
pathfile path
fullif true complete extension (all extensions, dot separated) is returned, otherwise (default) only last extension is returned
Returns
extension part of the file path
QString Qtx::file ( const QString &  path,
const bool  withExt = true 
)
static
Parameters
pathfile path
withExtif true (default) complete file name (with all extension except the last) is returned, otherwise only base name is returned
Returns
file name part of the file path
QString Qtx::findEnvVar ( const QString &  str,
int &  start,
int &  len 
)
static

Looks through the string for the environment variable patterns. If string contains variable satisfying any pattern, the variable name is returned, start index of the variable is returned in the start parameter, and length of the variable is returned in the len parameter.

Supported environment variables definitions:

  • ${name} or $name : Linux shell variable
  • : GNU make substitution
  • name% : Windows shell variable
  • %(name)s : Python substitutions:
Parameters
strstring being processed
startif variable is found, this parameter contains its starting position in the str
lenif variable is found, this parameter contains its length
Returns
first found variable or null QString if there is no ones

References rx.

QObject * Qtx::findParent ( QObject obj,
const char *  className 
)
static
Parameters
objcurrent object
classNameclass name of the parent
Returns
parent object or null pointer if the parent not found
void * Qtx::getDisplay ( )
static
Returns
Pointer to X display.
See Also
getVisual()
Qt::HANDLE Qtx::getVisual ( )
static
Returns
Pointer to X visual.
See Also
getDisplay()

References getDisplay(), hex(), and Plot2d::None.

QString Qtx::gradientToString ( const QLinearGradient &  gradient)
static
Parameters
gradientlinear gradient to be converted
Returns
string representation of the linear gradient
See Also
stringToLinearGradient()

References colorToString().

QString Qtx::gradientToString ( const QRadialGradient &  gradient)
static
Parameters
gradientradial gradient to be converted
Returns
string representation of the radial gradient
See Also
stringToRadialGradient()

References colorToString().

QString Qtx::gradientToString ( const QConicalGradient &  gradient)
static
Parameters
gradientconical gradient to be converted
Returns
string representation of the conical gradient
See Also
stringToConicalGradient()

References colorToString().

QImage Qtx::grayscale ( const QImage &  img)
static
Parameters
imginitial image
Returns
converted to the grayscale image
QPixmap Qtx::grayscale ( const QPixmap &  pix)
static
Parameters
pixinitial pixmap
Returns
converted to the grayscale pixmap

References grayscale().

bool Qtx::isParent ( QObject child,
QObject parent 
)
static

This function works recursively. It means that true is also returned if parent is a grand-father, grand-grand-father, etc of child. If the same object is given as both parent and child, true is also returned.

Parameters
childchild object
parentparent object
Returns
true if the parent is a parent of child

References obj.

QString Qtx::library ( const QString &  str)
static

The function appends platform-specific prefix (lib) and suffix (.dll/.so) to the library file name. For example, if str = "mylib", "libmylib.so" is returned for Linux and mylib.dll for Windows.

Parameters
strshort library name
Returns
full library name

References addSlash(), dir(), extension(), and file().

QColor Qtx::mainColorToSecondary ( const QColor &  color,
int  delta 
)
static

Secondary color is calculated by changing paremeters of the main color ("saturation" and "value" components in HSV notation) using specified delta.

If main color is invalid, result of the function is also invalid color.

Parameters
colorsource main color
deltadelta value
Returns
resulting secondary color
See Also
biColorToString(), stringToBiColor()

References OCCViewer::color().

QString Qtx::makeEnvVarSubst ( const QString &  str,
const SubstMode  mode = Auto 
)
static

Environment variable is substituted by its value.

Parameters
strstring to be processed
Returns
processed string (with all substitutions made)

References Always, findEnvVar(), and Never.

bool Qtx::mkDir ( const QString &  dirPath)
static
Returns
true if the directory is successfully created and false otherwise
QCompleter * Qtx::pathCompleter ( const PathType  type,
const QString &  filter = QString() 
)
static

Create an instance of QCompleter class and returns the pointer on it. The calling function is responsible to the desstroying of the created completer object.

The QCompleter class provides completions based on a item model and can be used in such as QLineEdit and QComboBox. When the user starts typing a word, QCompleter suggests possible ways of completing the word, based on a word list.

Parameters
typepath type (Qtx::PathType)
filterfile/directory filters (list of wildcards, separated by ";;")
Returns
a pointer to the created completer

References PT_Directory, PT_OpenFile, PT_SaveFile, and rx.

QString Qtx::qtDir ( const QString &  context = QString())
static

The function tries to detect qt installation directory by analyzing the system variables in the following order:

  • QT5_ROOT_DIR
  • QT4_ROOT_DIR
  • QT_ROOT_DIR
  • QTDIR

Optional parameter context allows obtaining subdirectory in the Qt installation directory.

Parameters
contextoptional sub-directory
Returns
path to the Qt installation directory (or its sub-folder, if context is specified)
int Qtx::rgbSet ( const QColor &  c)
static
Parameters
cunpacked color
Returns
packed color
int Qtx::rgbSet ( const int  r,
const int  g,
const int  b 
)
static
Parameters
rred component
ggreen component
bblue component
Returns
packed color
QColor Qtx::rgbSet ( const int  rgb)
static
Parameters
rgbpacked color
Returns
unpacked color (QColor)

References rgbSet().

void Qtx::rgbSet ( const int  rgb,
int &  r,
int &  g,
int &  b 
)
static
Parameters
rgbpacked color
rreturned unpacked red component
greturned unpacked green component
breturned unpacked blue component
bool Qtx::rmDir ( const QString &  thePath)
static
Returns
true if the directory is successfully removed and false otherwise
QColor Qtx::scaleColor ( const int  index,
const int  min,
const int  max 
)
static
Parameters
indexcolor index
minrequired minimum hue value
maxrequired maximum hue value
Returns
resulting color
void Qtx::scaleColors ( const int  num,
QColorList lst 
)
static
Parameters
numrequired number of colors
lstreturned set of colors

References scaleColor().

QPixmap Qtx::scaleIcon ( const QPixmap &  icon,
const unsigned  w,
const unsigned  h = 0 
)
static

If h is 0 (default) the value of w is used instead (to create square pixmap).

Parameters
iconpixmap to be resized
wrequired pixmap width
hrequired pixmap height
Returns
scaled pixmap
void Qtx::setTabOrder ( QWidget first,
  ... 
)
static

The function has arbitrary number of parameters, each should be hovewer of QWidget* type. Last parameter should be null pointer.

Parameters
firstfirst widget in the sequence
void Qtx::setTabOrder ( const QWidgetList &  widgets)
static
Parameters
widgetslist of widgets
void Qtx::simplifySeparators ( QWidget wid,
const bool  recursive = true 
)
static
Parameters
widwidget, should be of QMenu* or QToolBar* class
Qtx::BackgroundData Qtx::stringToBackground ( const QString &  str)
static

The string should consist of several sub-strings separated by ';' symbol. Each sub-string consists of keyword/value couple, in form of "<keyword>=<value>". The sub-strings can follow in arbitrary order, some keywords can be missing. The background data is described by the following values:

  • background type (enumerator, see Qtx::BackgroundMode), keyword "bt"
  • texture image file name (string), keyword "fn"
  • texture mode (enumerator, see Qtx::TextureMode), keyword "tm"
  • "show texture" flag (boolean), keyword "ts"
  • first color (for simple gradient data) or solid color (for single-colored mode), keyword "c1"
  • second color (for simple gradient data), keyword "c2"
  • name of gradient type (string), keyword "gt"
  • complex gradient data (for custom gradient mode), keyword "gr"

Also, for backward compatibility, background data can be represented by single color value, see stringToColor().

Backward conversion can be done with backgroundToString() method. Returns invalid background if conversion could not be done.

if ( bgData.isValid() ) ) doSomething( bgData );
Parameters
theStringstring representation of the background data
Returns
resulting background data (invalid if conversion has failed)
See Also
backgroundToString()

References CenterTexture, ColorBackground, CustomGradientBackground, NoBackground, Qtx::BackgroundData::setColor(), Qtx::BackgroundData::setGradient(), Qtx::BackgroundData::setMode(), Qtx::BackgroundData::setTexture(), Qtx::BackgroundData::setTextureShown(), StretchTexture, stringToColor(), stringToConicalGradient(), stringToInt(), stringToLinearGradient(), and stringToRadialGradient().

bool Qtx::stringToBiColor ( const QString &  str,
QColor &  color,
int &  delta 
)
static

Bi-color value is specified as main color and integer delta value that is used to calculate secondary color by changing paremeters of the main color ("saturation" and "value" components in HSV notation).

The parameter str should consist of two sub-strings separated by '|' symbol. The first part represents main color (see stringToColor() for more details), the second part is a delta value.

Backward conversion can be done with biColorToString() method.

Parameters
strstring representation of the bi-color value
colorresulting color value
deltaresulting delta value
Returns
true if the conversion is successful and false otherwise
See Also
biColorToString(), stringToColor(), rgbSet()

References stringToColor().

bool Qtx::stringToColor ( const QString &  str,
QColor &  color 
)
static

The parameter str must be in the one of following formats (RR, GG, BB and AA value represent red, green, blue and alpha components of the color):

  • "#RR,#GG,#BB[,#AA]" or "#RR #GG #BB[ #AA]" (RR, GG, BB and optional AA values represent red, green, blue and alpha components of the color in hexadecimal form)
  • "RR,GG,BB[,AA]" or "RR GG BB[ AA]" (RR, GG, BB and optional AA values represent red, green, blue and alpha components of the color in decimal form)
  • "#RRGGBB" - (RR, GG and BB values represent red, green and blue components of the color in hexadecimal form)
  • an integer value representing packed color components (see rgbSet())
  • a name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro".

Backward conversion can be done with colorToString() method.

Parameters
strstring representation of the color
colorresulting color value
Returns
true if the conversion is successful and false otherwise
See Also
colorToString(), rgbSet()

References rgbSet().

bool Qtx::stringToConicalGradient ( const QString &  str,
QConicalGradient &  gradient 
)
static
Parameters
strstring representation of the conical gradient
gradientresulting conical gradient object
Returns
true if the conversion is successful and false otherwise
See Also
gradientToString()

References stringToColor().

QFont Qtx::stringToFont ( const QString &  fontDescription)
static

Creates font from string description

bool Qtx::stringToLinearGradient ( const QString &  str,
QLinearGradient &  gradient 
)
static
Parameters
strstring representation of the linear gradient
gradientresulting linear gradient object
Returns
true if the conversion is successful and false otherwise
See Also
gradientToString()

References stringToColor().

bool Qtx::stringToRadialGradient ( const QString &  str,
QRadialGradient &  gradient 
)
static
Parameters
strstring representation of the radial gradient
gradientresulting radial gradient object
Returns
true if the conversion is successful and false otherwise
See Also
gradientToString()

References stringToColor().

QString Qtx::tmpDir ( )
static
Returns
temporary directory (platform specific)
QString Qtx::toQString ( const char *  str,
const int  len = -1 
)
static
Parameters
strcharacter array
lenarray length, if < 0, the array should be zero-terminated
Returns
QString object
QString Qtx::toQString ( const short *  str,
const int  len = -1 
)
static
Parameters
strinteger array
lenarray length, if < 0, the array should be zero-terminated
Returns
QString object

References toQString().

QString Qtx::toQString ( const unsigned char *  str,
const int  len = -1 
)
static
Parameters
strcharacter array
lenarray length, if < 0, the array should be zero-terminated
Returns
QString object

References s.

QString Qtx::toQString ( const unsigned short *  str,
const int  len = -1 
)
static
Parameters
strinteger array
lenarray length, if < 0, the array should be zero-terminated
Returns
QString object

References s.

QImage Qtx::transparentImage ( const int  w,
const int  h,
const int  d = -1 
)
static
Parameters
wrequired image width
hrequired image height
drequired image depth
Returns
generated image
QPixmap Qtx::transparentPixmap ( const int  w,
const int  h,
const int  d = -1 
)
static
Parameters
wrequired image width
hrequired pixmap height
drequired pixmap depth
Returns
generated pixmap

References transparentImage().

long Qtx::versionToId ( const QString &  version)
static

String representation of the version consists of zero or more components:

[major[.minor[.release[patchid]]]]

where

  • major is version major number
  • minor is version minor number
  • release is version release number
  • patchid is a version dev identifier which is one of the following 1 letter optionally followed by 1 or 2 digits, e.g. "a" for "alpha", "b1" for "beta 1" "rc" optionally followed by 1 or 2 digits, e.g. "rc1" for "release candidate 1" "dev" for development version (note: 7.4.0dev > 7.4.0, 7.4.0dev < 7.4.1, 7.4.0dev < 7.4.0a1)

If version string does not include any component or has invalid format, the function returns 0.

Examples: 1.0 - version 1.0 1.2.3a - version 1.2.3 alpha 3.3.3b1 - version 3.3.3 beta 1 7.4.0rc1 - version 7.4.0 release candidate 1 7.4.0dev - dev version, i.e. future version 7.4.1 (or 7.5.0)

Parameters
versionstring representation of version
Returns
numerical identifier of the version

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