Back to index

salome-gui  6.5.0
Qtx Class Reference

A set of helpful utility functions. More...

Inheritance diagram for Qtx:
Inheritance graph


class  BackgroundData
 Stores background data. More...
class  Localizer
 Localization helper. More...

Detailed Description

A set of helpful utility functions.

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

Class Documentation

class Qtx::BackgroundData

Stores background data.

This class is used to store background data. Depending on the mode, the background can be specified by:

  • image (by assigning the file name to be used as background texture), see setTexture(), setTextureShown()
  • single color (by assigning any color), see setColor()
  • simple two-color gradient (with the gradient type id and two colors), see setGradient( int, const QColor&, const QColor& )
  • complex gradient (by assigning arbitrary gradient data), see setGradient( const QGradient& )

The class stores all the data passed to it, so switching between different modes can be done just by calling setMode() function.

Texture is used with combination of the background mode.
Two-color gradient is specified by two colors and integer identifier. The interpretation of this identifier should be done in the calling code.
  Qtx::BackgroundData bg;
  bg.setColor( QColor(100, 100, 100) );                  // bg is switched to Qtx::ColorBackground mode
  bg.setGradient( Qt::Horizontal, Qt::gray, Qt::white ); // bg is switched to Qtx::ColorBackground mode
  QLinearGradient grad( 0,0,1,1 ); 
  grad.setColorAt( 0.0, Qt::gray ); 
  grad.setColorAt( 0.5, Qt::white );
  grad.setColorAt( 1.0, Qt::green );
  grad.setSpread( QGradient::PadSpread );
  bg.setGradient( grad );                                // bg is switched to Qtx::CustomGradientBackground mode
  bg.setMode( Qtx::ColorBackground );                    // bg is switched back to Qtx::ColorBackground mode
  bg.setTexture( "/data/images/background.png" );        // specify texture (in the centered mode by default)
  bg.setTextureShown( true );                            // draw texture on the solid color background
class Qtx::Localizer

Localization helper.

This helper class can be used to solve the localization problems, usually related to the textual files reading/writing, namely when floating point values are read / written with API functions. The problem relates to such locale specific settings as decimal point separator, thousands separator, etc.

To use the Localizer class, just create a local variable in the beginning of the code where you need to read / write data from textual file(s). The constructor of the class forces setting "C" locale temporariy. The destructor switches back to the initial locale.

  Qtx::Localizer loc;

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